ImageMagick Perform differently under different os

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
carol_sun
Posts: 19
Joined: 2009-11-06T00:49:59-07:00
Authentication code: 8675309

ImageMagick Perform differently under different os

Post by carol_sun »

ImageMagick version: 6.3.0
I installed it under different linux os , one is SUSE-Linux(gcc version 4.1.2 ), the other is slackware-linux(gcc version 3.3.4).
After install ImageMagick-6.3.0 in two computers, I used command "./convert -scale 500X500 102.jpg result.jpg " to resize my picture.

The result in two computers is different.
The size of result.jpg is 64579 in suse-linux, and 64577 in slackware-linux. So absolutely their md5 hash is different.

Now I wonder why they are different ? Can I do something to make them the same.
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: ImageMagick Perform differently under different os

Post by GreenKoopa »

Isn't the newer syntax "convert 102.jpg -scale 500X500 result.jpg"? Not that this is likely your issue.
http://www.imagemagick.org/Usage/basics/#why

Do you have this problem when using a lossless image file format, like PNG instead of jpeg?
carol_sun
Posts: 19
Joined: 2009-11-06T00:49:59-07:00
Authentication code: 8675309

Re: ImageMagick Perform differently under different os

Post by carol_sun »

It has nothing to do with the syntax. I had try it.
I also have this problem when resizing PNG and BMP.
GreenKoopa wrote:Isn't the newer syntax "convert 102.jpg -scale 500X500 result.jpg"? Not that this is likely your issue.
http://www.imagemagick.org/Usage/basics/#why

Do you have this problem when using a lossless image file format, like PNG instead of jpeg?
User avatar
GreenKoopa
Posts: 457
Joined: 2010-11-04T17:24:08-07:00
Authentication code: 8675308

Re: ImageMagick Perform differently under different os

Post by GreenKoopa »

Is the size of result.jpg always exactly 2 bytes more using suse-linux?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: ImageMagick Perform differently under different os

Post by anthony »

Images that were recreated, regardless of if it is that same machine or a different machine may not match using MD5. In fact this is so common I would give up of MD5 comparision except as a method to determine if an image was a direct and exact copy rather than one that was re-created using some form of image processing.

Image files can change depending on many many many MANY.. factors. Things like creation and last modified dates stored in the image file format, changes and updates to delegate libraries (libjpeg.so). Tweeking in the image processing or codec operations within IM, or just changed in the font processing (which seems very common with any change of OS).

JPEG in particular can be greatly effected, as it is a lossless file format.
The other format that I find that commonly sees a change, even when nothing really has, is GIF, as the Color Qualtization (reducing the number of colors in an image) is particularity sensitive to the most minor modification in how the image was processed.

IM provides a 'data signature' that can help you determine if two images it created are the same.
This is basically a MD5 checksum of just the image data, and ignores image meta-data. But really the only practical way to check if an image is different do a comparison of the to images and then look to see how much difference there is.

Basically images are always different. And not just because of IM. All image processing programs will generate different image file with the least provocation!

Comparing images is what I do when re-building 'example images' in IM examples to look for cases where the result of an example changed for some reason. I use it as a secondary check to discover bugs that may have been accidentally introduced. But even so I generally get lots of 'false positives' for image changes.

I suggest you do like wise and completely ignore image file size, checksums or any other 'global' file comparison method. At least for images.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply