• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

PNG support for colour profiles incomplete/unpredictable in CC 2018

Explorer ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

Hello,

The new Export As... Embed profile checkbox doesn’t work properly with PNG8 files (“Smaller Files”). Mac and Windows edition of CC 2018 behaves differently when it comes to recognising sRGB chunk in PNG files (incl. those saved from Photoshop). The new CC 2018 PNG support through Save As.. has lost an ability to embed colour profiles (it works correctly in CC 2017).

For a detailed report, please see: PNG8 colour support broken · Issue #392 · adobe-photoshop/generator-core · GitHub

Regards

m.

Views

3.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

PNG-8 is indexed color, which doesn't support icc profiles.

Export As PNG-24, as well as Save As PNG, both embed the profile correctly. Just tested in Win 10.

In other words, there's nothing wrong. Everything is as expected.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

Hi,

Thanks for the answer.

PNG-8 is indexed color, which doesn't support icc profiles.

Colour profiles are supported for all PNG types (indexed included): PNG Specification: Chunk Specifications​. As is sRGB chunk. Plenty of indexed PNGs in the wild with both and support for it in other applications. Even if Adobe would choose not to follow PNG spec and wide practice and add to confused colour all over the web by not supporting iCCP and sRGB chunks for indexed PNGs, they would need to disable checkboxes that currently aren’t working as advertised and are confusing.

Save As PNG (...) embed the profile correctly

Apologies. You’re right, I was mislead by unchecked AND greyed out Embed profile checkbox in Save As for images in sRGB. Profiles are correctly saved provided they are NOT sRGB. However, if the image is in sRGB, Photoshop CC2018 Win doesn’t write sRGB  or iCCP chunks (Export As PNG-24 saves iCCP, it could produce smaller files by using sRGB chunk, but at least it doesn’t produce incorrect files).

In other words, there's nothing wrong. Everything is as expected.

Not my experience, unfortunately. Also Mac and Windows versions are incompatible now (in CC 2018) when it comes to recognising sRGB chunks in files (incl. those they wrote themselves), amazingly – both are wrong (Win doesn’t recognise sRGB chunks, Mac sees them in PNGs without sRGB chunks).

Plenty to improve, I would say.

Coming back to colour profiles in indexed PNGs. I’ve used the spec argument above just to reinforce my point. But, to be honest, I don’t care for the spec as such. Imagine an indexed PNG with just one, red colour. Wouldn’t you want to know if that red is in sRGB or ProPhotoRGB?!

Regards

m.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

Colour profiles are supported for all PNG types (indexed included)

Well, maybe, I don't know. But if you're concerned with color accuracy, you wouldn't use indexed color in the first place. And vice versa.

Imagine an indexed PNG with just one, red colour. Wouldn’t you want to know if that red is in sRGB or ProPhotoRGB?!

Again, maybe. Same argument as hex color: an indexed PNG can be safely assumed to be intended for an sRGB environment.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

In photoshop cc 2018 have you tried File>Export>Save for Web?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

Hi,

if you're concerned with color accuracy, you wouldn't use indexed color in the first place

I respectfully disagree. PNG8 is still the only (sane) way to support images with transparency in some popular browsers (it doesn’t help that Photoshop doesn’t natively support JXR, WebP and only partly supports JP2). Why these images have to suffer unpredictable saturation shifts by being misinterpreted as being in display device’s space because of the lack of colour information?

an indexed PNG can be safely assumed to be intended for an sRGB environment

Yeah, that’s what the web specs say for years (about untagged imagery in general). Unfortunately browsers (and other applications/OSes) do not correctly assume sRGB for untagged images (situation is changing for the better as we speak, but still). Why would Photoshop want to add to that confusion? Again: even if that’s a (wrong) concious decision, UI suggests differently and is misleading.

In photoshop cc 2018 have you tried File>Export>Save for Web?

Thanks, Jeff. Save for Web has it’s own set quirks when it comes to colour profiles :-). But, crucially, its support for PNG8 is miserable compared to Export As... (only 1-bit transparency allowed).

I just thought it may be a good time to get engineer’s attention, which I’ve tried using different channels for a while now, as the PNG code was definitely touched in CC 2018 and better support for PNG is being advertised ;-).

Maybe it would be prudent to make Photoshop correctly recognise sRGB PNG chunks and then always use those when writing PNGs in sRGB colour space instead of unnecessarily weighty iCCP chunks, too (2,6KB extra)? For the files to be smaller, but also to avoid long-standing issues like Original sRGB profile is not correctly recognised as such by IM/libpng (culprit: pngcrush code to deal with it​?). But here, I’m a newbie and this is way above my understanding...

Regards

m.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 22, 2017 Oct 22, 2017

Copy link to clipboard

Copied

Unfortunately browsers (and other applications/OSes) do not correctly assume sRGB for untagged images\

Firefox has done that for many years (with the mode 1 setting), and I hear Chrome and Opera do it too now. On Mac, Safari has to do it, ever since Apple started fitting the iMacs and MBPs with wide gamut displays.

So that basically just leaves Edge/IE - but Microsoft's browsers have always been known for their lacking color management support. Nothing new there.

The OS isn't supposed to assume anything. This is called by the application, not the OS - it's just supposed to make the profiles available when the application requests it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 14, 2021 Jan 14, 2021

Copy link to clipboard

Copied

It does not support gAMMA chunks too. And example (with gAMA chunk 50 (that is encoding gamma 0.02)): https://superuser.com/questions/579216/why-does-this-png-image-display-differently-in-chrome-firefox...

You can use exiftool to see it.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

A few things to clear up in this old thread from 2017, as some of the things I wrote back then aren't correct. Or not correct anymore, they may have changed.

 

PNG icc profile support is indeed very inconsistent in Photoshop, and I'm sure a lot of it qualifies as bugs.

  • Save As PNG will not embed the profile if that profile happens to be sRGB. Which is of course the profile you need in almost all cases. All other profiles are correctly embedded.
  • Export and Save For Web both embed profiles correctly. However, the "embed profile" checkbox is not only off by default - but in Export it doesn't even stick when you check it. You have to do it every time (!).

 

As for web browsers, there's been some significant changes. The most important one is that Microsoft Edge now has full color management, and it has also adopted the policy of assigning sRGB to untagged material, not only images, but all page elements. This means all major web browsers should now display everything correctly, with full color management everywhere. The only browser lagging a little behind is Firefox, where you still have to manually enable the "assign sRGB" function (mode 1).

 

This also means that for web, embedding the profile is no longer strictly necessary. However, most standard image viewers still require a profile, if they support color management at all. Considering that an sRGB profile is only 3kB, there is absolutely no reason to not embed. It's still the only way to maximize the chances of correct representation.

 

The original question was about 8-bit indexed PNGs. Whether icc profile support is technically possible with indexed color is moot and beside the point. It simply makes no sense, and if accurate color is a consideration you don't use indexed color.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jan 15, 2021 Jan 15, 2021

Copy link to clipboard

Copied

For web the standard mandates that images without iCCP (icc) or gAMA chunks (gamma) (for png) or sRGB chunk and others are parsed as sRGB. That is mandatory, firefox is breaking the standrd here, there is a bug in firefox and you can activate about:config to 1. Anyway, GIMP also does not support gAMA chunk, there is an open bug there too.

 

For other apps, it is technically should be like that too, no standard exist, of course.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 27, 2021 Oct 27, 2021

Copy link to clipboard

Copied

A few things to clear up in this old thread updated in 2021 as some of the things said are incorrect and some other things have changed.

 

quote

The original question was about 8-bit indexed PNGs. Whether icc profile support is technically possible with indexed color is moot and beside the point. It simply makes no sense, and if accurate color is a consideration you don't use indexed color.


By @D Fosse

 

This probably imagines a beautiful full-colour image being degraded by 8-bit indexed colour and the assumption is made that such a degradation trumps the fact that the colour is incorrect because of missing/incorrect profiles. This is a misunderstanding. To see why, imagine a flat one-colour, red PNG8. This red colour will appear wildly different depending on the image colour space, so correctly embedded profiles are as crucial as for any beautiful image. So ICC profile support is as important for indexed colour as for any other image mode. What is of course very true, is that no one sane would ever use indexed colour for any images that won’t benefit from it (practically: in a web delivery), but this has nothing to do with colour management…

 

Things have changed in version 23.0, but not always for the better (better colour management of Export As… is advertised in Release notes). sRGB profiles are again allowed to be embedded in PNG images via Save As… (yay!), but instead of a tiny sRGB chunk a bloated 2,6KB sRGB profile is saved (boo! both Export As… and Save As…). sRGB chunks are still not recognised when opening PNG images (boo!). Some ICC profiles are now correctly saved via Save As… and Export As… including for indexed PNG8 (yay!), but some others – aren’t, like standard Photoshop greyscale ones (boo!; eg. Dot Gain 20% or Gray Gamma 1.8 is replaced with an sRGB profile, sic!). Bundled pngquant is still 7 years old… Hopefully, this thread won’t live to such an old age 😉

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Yes, Save As now embeds sRGB correctly in PNG. That's a major and important fix!

 

There was also a bug in Export that prevented correctly color managed display in the dialog. That's also fixed now, excellent.

 

There remains an overriding problem in Export: the "embed profile"-box is still unchecked by default, and it still doesn't stick when you check it. Fix that, and I might start using it. Nowadays there's no reason to not have it checked. Checked should be default, unchecked optional.

 

Grayscale profiles converted to sRGB makes perfect sense and I fully agree with that policy. Not a single application that I know of outside Photoshop will color manage grayscale correctly. These profiles are randomly treated everywhere, whether they are embedded or not. And the results are all over the map. Grayscale profiles on the internet would be chaos.

 

The standard sRGB IEC61966-2.1 profile is about 3kB, which is nothing of practical significance. I've no idea what you mean by "chunks". If it's a small icon, 3 kB makes a difference, granted, but then you can still uncheck the box.

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

witkacy_0-1635434433069.png

Grayscale profiles converted to sRGB makes perfect sense and I fully agree with that policy.

By @D Fosse

 

I do not, but that’s beside the point. Current behaviour is incorrect and needs fixing. Any colour managed application deals with them correctly. Silent conversion (if it even is a conversion and not just misattribution, I haven’t checked), despite clear UI signals to the contrary (Convert to sRGB unchecked) adds confusion to the incorrect behaviour. Even if there would be applications that have problems with grayscale profiles that would not be a reason for Photoshop to be incorrect. If only because we would be reading on their forums that “even Photoshop cannot get that right, what would you expect?!”.

witkacy_1-1635434433069.png

 

The standard sRGB IEC61966-2.1 profile is about 3kB, which is nothing of practical significance.

 

On the web every byte matters. Not being able to correctly support a 25 year old specification in the major commercial product is just weak. Even more so, because the limitation was known for years and this area was recently looked at (and improvements advertised).

 

witkacy_0-1635429750113.png

I've no idea what you mean by "chunks".

 

Standard building blocks of the file fomat we are discussing here. Here is a definition of a sRGB chunk.

 

witkacy_0-1635429750113.png

If it's a small icon, 3 kB makes a difference, granted, but then you can still uncheck the box.

 

Again, the whole thread discusses the need to correctly embed colour profile information, so unchecking the box is not a viable option. For a PNG in sRGB colour space correct colour profile information is stored in a sRGB chunk, if only because of the file size savings it brings. Even more so because Export As… is advertised as a tool for creating optimised assets for the web etc.

 

I agree with you, D Fosse, that the state of the checkboxes should be remembered in the Export As… command!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 31, 2021 Oct 31, 2021

Copy link to clipboard

Copied

DFosse: "There remains an overriding problem in Export: the "embed profile"-box is still unchecked by default, and it still doesn't stick when you check it. Fix that, and I might start using it. Nowadays there's no reason to not have it checked. Checked should be default, unchecked optional."

 

Absolutely, there's no way embed should be unchecked, saving with the profile should always be the default I totally agree

 

I hope this helps
neil barstow, colourmanagement net :: adobe forum volunteer

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 28, 2021 Oct 28, 2021

Copy link to clipboard

Copied

Witcasy

 

         "ICC profile support is as important for indexed colour as for any other image mode."

totally agree - since continuity of colour appearance relies entirely on embedded profiles (yeah, ideally small ones, especially for web) it seems ridiculous that ANY image format is unable to support them in Adobe apps.

 


neil barstow, colourmanagement net :: adobe forum volunteer
google me "neil barstow colourmanagement" for lots of free articles on colour management
[please only use the blue reply button at the top of the page, this maintains the original thread title and chronological order of posts]

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 29, 2021 Oct 29, 2021

Copy link to clipboard

Copied

GIMP now supports gAMA chunk!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

In the year 2022AD, Photoshop still can't seem to write out or read a PNG sRGB chunk.  Apple Preview then takes these images, and displays them as non-SRGB data.   Considering that most of the content that we're designing is in srgb8 space, this basically means ignoring any sRGB chunk since Photoshop will never write it out, and overriding it by identifying the image as an albedo map (srgb), normal map (non-srgb), or other map in games.   Why has Photoshop had PNG export without this for it's lifespan?  And embedding 3K iCCP profiles to indicate sRGB isn't cool either in the deprecated "Save for Web".   

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Mar 10, 2022 Mar 10, 2022

Copy link to clipboard

Copied

quote

embedding 3K iCCP profiles to indicate sRGB isn't cool either in the deprecated "Save for Web".   

 

By @defaultp677vp74sy2q

 

So you don't want to embed the sRGB profile, but still expect other applications to treat it as sRGB? I don't see how this is a Photoshop problem. It's treated as sRGB if the profile is embedded and the application is color managed.

 

Policies for untagged images vary between applications. Web browsers will automatically assign sRGB, but most other applications will just pass the RGB numbers straight through to screen.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 11, 2022 Mar 11, 2022

Copy link to clipboard

Copied

Web browsers break with sRGB, gama, chrm, or iccp embedded in them.  They try to convert and store the data in linear space.  That means to use the browser loaders that go to native C++ libraries, the blocks must all be stripped, and the srgb state passed separately.  So it still needs to be there, but that doesn't mean it's handled consistently.

 

I finally updated from PS2021 to PS2022 and "Save As" finally has and option to save a srgb profile but it's a gama and iccp block.  There are about a million different iccp blocks, some from Apple. Some from Adobe, and other image programs.  There is one sRGB block and it's a simple Boolean to check in png loaders.  What is the code to test iccp blocks across all vendors?

 

My point about not having sRGB is about all of our files saved by artists still using PS2021 and older.  That's why I have to ignore the setting, but Apple a preview doesn't.   None of these files have sRGB written or read, so we have to supplement that data when processing the images.  Also Photoshop has no ktx or ktx2 export which is ultimately what we generate for games.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

Spent a few hours on this today, and this is such a big waste of everyone's time.   I pulled the lodepng code to print out some of the ICCP fields, but it doesn't support all of them.   GPUs really don't support a fully general icc color profile in hardware.  They do sRGB, and whatever specific variant of sRGB that was chosen.  Let's say Rec709.   

 

So I have the white point tristimulus, but what do I need to test to identify this as sRGB.  I pulled the icc profile samples from the ICC website, and still have no idea what to match up here.  I can fallback to the GAMA for the PS2022 files, but have some files from Apple that only have an ICCP block in the PNG file.   And I think Apple doesn't read the Photoshop ICCP properly to identify sRGB.   This data structure is 132 bytes at minimum, and often much larger like 3K.  And this is somehow better than saving out a boolean sRGB value?  

 

Also does Photoshop honor reading sRGB, and do sRGB to linear conversion before premultiplying with alpha?  My evidence is that's not the case.  And that it treats the colors as linear (even with the block), and does srgb * a.  

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

Two key browsers (chromium and firefox) correctly see sRGB chunk that ovewrites gAMA and cHRM chunk, just like iCCP overites sRGB chunk as per png spec. And browsers do render it all correctly, chrome even in hdr, pq up to 10000 nits.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

"3K iCCP profiles to indicate sRGB isn't cool either in the deprecated "Save for Web" I agree, and it (the iCCP chunk) is also zlib compressed and different versions of zlib (and now zlib-ng) compress it differently! LOL! I will also point out that there is v2 ICC profile from color.org and there is v4. v4 has much higher precision than v2, and yet it is not supported by iCCP chunk, different chunk was done in w3 png spec. Ideally just omit any chunk like sRGB or gAMA or cHRM and it will be true sRGB.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

"GPUs really don't support a fully general icc color profile in hardware.  They do sRGB, and whatever specific variant of sRGB that was chosen.  Let's say Rec709.   " This is false. Of course they do. And not lets say it is rec 709, it is only rec 709 primaries. Your confusion comes from the fact primaries are modifed in icc profile (chromatically adapted to d50). That does not make them non-709.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

"I can fallback to the GAMA for the PS2022 files, but have some files from Apple that only have an ICCP block in the PNG file." You cannot, no gAMA allows for sRGB curve.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Mar 12, 2022 Mar 12, 2022

Copy link to clipboard

Copied

"Also does Photoshop honor reading sRGB, and do sRGB to linear conversion before premultiplying with alpha?  My evidence is that's not the case.  And that it treats the colors as linear (even with the block), and does srgb * a.  "

It does not, because it does not need to. Not tagged images are sRGB. It is mandated. Alpha is linear, yes, this was bug as a feature situation. Too late to fix though, this is in soec now.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines