KhronosGroup / KTX-Software

KTX (Khronos Texture) Library and Tools
Other
881 stars 231 forks source link

PNG file has an ICC profile chunk. These are not supported #252

Closed zeux closed 4 years ago

zeux commented 4 years ago

I'm getting this error on CesiumLogoFlat.png from glTF-Sample-Models repository:

https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0/BoxTextured/glTF

When trying to convert .png to .ktx2 using toktx. This makes it difficult to use toktx in glTF workflows; note that basisu can convert this file (to .basis) just fine. It would be great to either fix this, or at least to provide a command-line option to suppress this check.

MarkCallow commented 4 years ago

The error is because we want toktx to be color correct and as yet there is not yet support for general color transforms. basisu will be ignoring this chunk rather than doing any color transform. I am considering using littlecms to support general transforms. In the meantime I could make the --linear and --srgb flags suppress the check.

MarkCallow commented 4 years ago

I'll be happy to accept a PR to add littlecms support.

lexaknyazev commented 4 years ago

toktx certainly should support overriding input file's color profile. There're many PNG (and JPEG) files with embedded profiles in the wild.

juber-nunes commented 3 years ago

Hi @MarkCallow has the fixes for this issue been pushed? I'm facing same issue still with beta-7. Is there a way around to convert those type of files?

lexaknyazev commented 3 years ago

Is there a way around to convert those type of files?

Removing an ICC chunk from the PNG with some optimization tool would work.

juber-nunes commented 3 years ago

@lexaknyazev That's great, would you have any experience with any of those, or perhaps a particular one that you'd suggest?

lexaknyazev commented 3 years ago

Here's the easiest one: https://squoosh.app/ (select OxiPNG as an encoder). Keep in mind that it applies the embedded ICC to pixel data during processing.

donmccurdy commented 1 year ago

Would we be open to mentioning --assign_oetf as an option in the error message? I'm seeing three.js users run into this error and not know how to deal with it, as ICC Profiles are not necessarily their choice in texture editing software, and pre-processing is more work.