KTX-Software icon indicating copy to clipboard operation
KTX-Software copied to clipboard

toktx error: JPGD_UNEXPECTED_MARKER

Open rawnsley opened this issue 2 years ago • 2 comments

toktx (v4.0.0~6) fails when compressing this JPEG.

% toktx bad-image.ktx bad-image.jpeg                  
toktx: failed to create image from bad-image.jpeg. JPEG decode failed

I got slightly more info when running in a different environment:

JPEG decode failed: JPGD_UNEXPECTED_MARKER

As far as I can tell the JPEG is well formed. GIMP says it has a color profile, which I know is a problem when compressing PNG files, but I have never had the problem with JPEGs before and the error message is opaque.

Possibly related to this issue, but I couldn't tell at a glance if you are using this decode library.

rawnsley avatar Aug 17 '23 07:08 rawnsley

We're using the same decoder so this is probably the same issue as you pointed at. Do you also see this only on a Nexus 3 or on other devices?

Neither toktx nor the new ktx create tool support loading files (of any format) with ICC color profiles so even if the JPGD_UNEXPECTED_MARKER is fixed you will not be able to create a texture from this file. You will have to use an image processing tool to convert it to a known colorspace.

MarkCallow avatar Aug 19 '23 11:08 MarkCallow

@MarkCallow The files were saved in Adobe Lightroom, which I'm guessing is where the color profile was added. I've added some more examples to the related issue in the upstream library. I understand about the ICC color profile restriction.

rawnsley avatar Aug 20 '23 07:08 rawnsley