Page 1 of 1

Color of image is changed after converting from JPG to JPG

Posted: 2019-02-26T00:22:43-07:00
by long.to
Hi,
I got an issue when convert JPG to JPG, color of converted file is changed.
I tried with many args to test like: -type TrueColor, -strip, -set colorspace:auto-grayscale off,... or without arg but the problem is still there.
Maybe there are something I don't know to put in arg to keep original color of image?
Sample code:

Code: Select all

convert.exe <arg> image1.jpg output.jpg
I'm using ImageMagick-7.0.8-18-portable-Q16-x86 in Windows 10.

Sample files and the different: https://drive.google.com/file/d/18D3gGM ... sp=sharing

Thanks.

Re: Color of image is changed after converting from JPG to JPG

Posted: 2019-02-26T03:34:45-07:00
by snibgo
You are writing jpg, and this is lossy, so there will almost certainly be some difference (especially with graphics images).

I can't see any difference in your difference image.

We can test the difference:

Code: Select all

f:\web\im>%IMG7%magick image1.jpg x.jpg

f:\web\im>%IMG7%magick compare image1.jpg x.jpg -metric RMSE NULL:
125.274 (0.00191156)
The RMSE difference is about 0.19%, which is very little.

If you can see a difference, please post your output.jpg.

Re: Color of image is changed after converting from JPG to JPG

Posted: 2019-02-26T19:29:58-07:00
by long.to
The RMSE difference of my images is about 0.0019%, too, but when I use Beyond Compare to check this 2 files, there are a lot of differences between them. The color of background is different.. You can check with my Untitled.png in the link below. I also attach my converted image (compare.jpg) into the zip file.
https://drive.google.com/file/d/15bsFTu ... sp=sharing

Re: Color of image is changed after converting from JPG to JPG

Posted: 2019-02-27T04:12:12-07:00
by snibgo
Yes, many pixels are slightly different. As your Untitled.png shows, most differences occur at boundaries between solid colours, eg blue and white. With an image editor, I see the difference is about 2% in these regions. This is typical of JPG compression of graphic images.

JPG is lossy. If you don't want changes, don't write to JPG.