Wrong colors after conversion PNG > JPG, why?

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
McSodbrenner
Posts: 5
Joined: 2016-06-10T04:26:47-07:00
Authentication code: 1151

Wrong colors after conversion PNG > JPG, why?

Post by McSodbrenner »

Hi,

I've converted this PNG to a JPG with the command:

Code: Select all

>magick in.png -quality 100 out.jpg
(Version: Windows, ImageMagick 7.0.5-4 Q16 x64 2017-03-25)

Here are both images:
http://test.cerdmann.com/imagemagick/in.png
http://test.cerdmann.com/imagemagick/out.jpg

If you open them in Chrome or Firefox you will see that the JPG is a little bit brighter (or more saturated). And I don't understand why.

Both are in color space sRGB and there is no color profile involved:

Code: Select all

>magick identify in.png
in.png PNG 512x512 512x512+0+0 8-bit sRGB 475KB 0.000u 0:00.000

>magick identify out.jpg
out.jpg JPEG 512x512 512x512+0+0 8-bit sRGB 404KB 0.000u 0:00.000
Aside from that: If I open them in Photoshop or the Windows 10 image viewer both images are displayed identically.
In the browsers they aren't.

What am I missing here?

Thanks,
Christoph
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Wrong colors after conversion PNG > JPG, why?

Post by fmw42 »

Generally, different viewers may interpret sRGB without a profile differently. So I suggest you always add an sRGB profile to your images if you want them to look the same in different browsers.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong colors after conversion PNG > JPG, why?

Post by snibgo »

In my Firefox 53.0.2 on Windows 8.1, I can see no difference between the images.

If your Firefox is old, an upgrade may help.

Perhaps one of the gfx.color_management settings in about.config is bad.

Are you using a PC with sRGB monitor, or something else?
snibgo's IM pages: im.snibgo.com
McSodbrenner
Posts: 5
Joined: 2016-06-10T04:26:47-07:00
Authentication code: 1151

Re: Wrong colors after conversion PNG > JPG, why?

Post by McSodbrenner »

Firefox 53.0.2 (64-Bit) on Windows 10 with differences.
But I guess it has something to do with the color profile of my monitor (Dell U2412M). Read about a lot of misconceptions regarding browsers and color profiles.
But I still don't understand why both images are not treated the same...
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Wrong colors after conversion PNG > JPG, why?

Post by snibgo »

McSodbrenner wrote:But I still don't understand why both images are not treated the same...
Nor do I. That would be a question for the Firefox people.

You might try a round-trip. You have created a jpg from a png, and Firefox shows them as different. Now create a second png from that jpg. Does it look like the first png, or the jpg?
snibgo's IM pages: im.snibgo.com
McSodbrenner
Posts: 5
Joined: 2016-06-10T04:26:47-07:00
Authentication code: 1151

Re: Wrong colors after conversion PNG > JPG, why?

Post by McSodbrenner »

Sorry, for the late answer. I've taken a vacation.

I've created the PNG from the JPG and it looks like the source image. What emerges from this?

The PNG have a slightly different gamma value:
in.png: 0.45455
out.jpg: 0.454545
rebuild.png: 0.45455
Does that matter that much?
Post Reply