ARM-software / astc-encoder

The Arm ASTC Encoder, a compressor for the Adaptive Scalable Texture Compression data format.
https://developer.arm.com/graphics
Apache License 2.0
1.07k stars 239 forks source link

The png do not support to load #463

Closed liumazi closed 6 months ago

liumazi commented 6 months ago

This condition is not met, in wuffs-v0.3.c if (self->private_impl.f_seen_trns || (self->private_impl.f_color_type > 3) || ((self->private_impl.f_color_type == 3) && !self->private_impl.f_seen_plte)) MakeMirAtlasFromAgePreview.zip

solidpixel commented 6 months ago

What tool created the PNG?

I'll try and update to the latest Wuffs release, but if that doesn't work I'll have to raise an issue upstream (https://github.com/google/wuffs) so I can't promise a quick fix.

liumazi commented 6 months ago

I use the TPngObject in Delphi to created the PNG. (Portable Network Graphics Delphi 1.5) Only a few PNGS fail to load, most are successful. And, if use astcenc.exe 1.3, will prompt: "Failed to load image xx.png, Reason: tRNS with alpha"

solidpixel commented 6 months ago

And, if use astcenc.exe 1.3, will prompt: "Failed to load image xx.png, Reason: tRNS with alpha"

The older release used stb_image to load images.

This error is thrown because the PNG is invalid (using a tRNS transparency chunk for a color format with alpha).

solidpixel commented 6 months ago

The latest Wuffs stable release doesn't fix this, so I've raised an issue upstream to see if they can support this use case in future, but the main problem here is that the image is technically out-of-spec (a tRNS chunk isn't allowed for RGBA color type images).

solidpixel commented 6 months ago

Upstream did a super-quick fix ❤️, so I'll update shortly.

solidpixel commented 6 months ago

Fixed in 56395a6fcecaac81ee7c3f03d86dc3c7689f6816