在php中比较2张图片 [英] Compare 2 images in php

查看:145
本文介绍了在php中比较2张图片的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

比较两个图像以查看它们是否都是相同的文件很容易,丢弃文件MD5,但是可能或甚至似乎确定是否两个图像相同,使用PHP GD来获得两个图像的差异。如果我们在哪里得到两者的差异,它是全白色的(id假设白色,甚至黑色),那么我们现在会知道它两个相同的照片?



另外注意:id想知道是否可能获得2个大小相等的图像来创建洋葱皮效果,50%透明度在1和50%在另一个。

解决方案

ImageMagick通过PHP ImageMagick扩展提供了各种可用于此的工具。



http://www.php.net/manual/en/function.imagick-compareimages.php



最大的问题是该库的文档几乎不存在,所以涉及到大量的试错。 p>

Comparing 2 images to see if they are both the same files are easy, threw the files MD5, but is it possible or even plausible to determine if 2 images are same by using PHP GD to get the difference of the two images. If we where to get the difference of the two, and it was all white (id assume white or even black), then we would now know its both the same photo?

Also side note: id like to know if its possible to get 2 images of equal size to create an onion skin effect, 50% transparency on 1 and 50% on the other.

解决方案

ImageMagick offers various tools you can use for this, through the PHP ImageMagick extension.

http://www.php.net/manual/en/function.imagick-compareimages.php

Biggest problem is that the documentation for that library is pretty much non-existing, so there will be a lot of trial-and-error involved.

这篇关于在php中比较2张图片的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆