Color of image is changed after converting from JPG to JPG

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
long.to
Posts: 7
Joined: 2018-11-01T19:31:14-07:00
Authentication code: 1152

Color of image is changed after converting from JPG to JPG

Post by long.to » 2019-02-26T00:22:43-07:00

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.

snibgo
Posts: 11932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo » 2019-02-26T03:34:45-07:00

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.
snibgo's IM pages: im.snibgo.com

long.to
Posts: 7
Joined: 2018-11-01T19:31:14-07:00
Authentication code: 1152

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

Post by long.to » 2019-02-26T19:29:58-07:00

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

snibgo
Posts: 11932
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post by snibgo » 2019-02-27T04:12:12-07:00

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.
snibgo's IM pages: im.snibgo.com

Post Reply