Page 1 of 1

About gif to jpg color distortion

Posted: 2018-06-09T23:42:40-07:00
by beginner
2.gif
Image

convert 2.gif -background white -flatten 2.jpg

2.jpg
Image


If you convert to a png image, the color will not be distorted

convert 2.gif -background white -flatten 2.png

2.png
Image


Why are the colors distorted when converted to jpg pictures?
What parameters convert.exe need to add to keep the jpg image color unchanged?

thanks

Re: About gif to jpg color distortion

Posted: 2018-06-10T00:12:53-07:00
by fmw42
Gif has limited colors (<=256) and palette type. When converted to jpg with lossy compression, you introduce new colors and 24-bit color. You would have to create a color map image and use -recolor to try to get the same colors back in your jpg, though that may not work, since JPG does not support 8-bit total color.

Re: About gif to jpg color distortion

Posted: 2018-06-10T00:27:47-07:00
by beginner
Thanks for your tip.

When I set the image compression quality to 100, the color is no longer distorted.

Image