pyvips icon indicating copy to clipboard operation
pyvips copied to clipboard

How to compare two images?

Open WeisiminPeng-Simmi opened this issue 2 years ago • 1 comments

Hi, may I ask how to compare two images? Thanks! I just want to know they are the same or not.

I found an issue in libvips repo: https://github.com/libvips/libvips/issues/1201 But i couldn't find that equal() method in pyvips.

WeisiminPeng-Simmi avatar Jul 21 '23 23:07 WeisiminPeng-Simmi

Hi @WeisiminPeng-Simmi,

In python, you can just do

(a == b).min() == 255

ie. compare the images pixel by pixel to make an image of 0 and 255, then search that for the minimum. If the min is 255, the images must be equal in every pixel.

jcupitt avatar Jul 22 '23 00:07 jcupitt