Skip to content Skip to sidebar Skip to footer

Different Image Data From The Same Source With Pillow

I am currently moving a script which creates local sensitive hashes from images from a windows host to a debian one. My problem is Pillow returns different image data from the same

Solution 1:

I personally would not expect the internal image representation to necessarily be identical between different machines &/or Operating Systems - especially if one of them is 64 bit and the other is 32 bit. That is not guaranteed and it is what you are calculating the image MD5 on - You are getting the same file MD5 on both systems so the file is identical if you need the image data MD5 then you should convert to a bitmap of known characteristics first - then MD5 the bitmap rather than the "image".

Solution 2:

I "solved" my problem. I had PIL and Pillow installed on the windows host by accident. It looks like it choose to use the PIL version. After using PIL on the debian machine, too the results are the same on both machines. Generally it would be wiser to upgrade the PIL side to use Pillow, but in my case i need to generate the exact same hashes like i did with the PIL version.

Morale of the story: PIL and Pillow may return different image data when loading the same images.

Post a Comment for "Different Image Data From The Same Source With Pillow"