Skip to content

Conversation

red-001
Copy link

@red-001 red-001 commented Aug 6, 2024

I license past and future contributions under the dual MIT/Apache-2.0 license,
allowing licensees to choose either at their option.

The decoder does the same thing as the BMP decoder, and converts 16-bit and 15-bit packed pixels to 24/32-bit ones on load.

This change implements #559 .

@red-001 red-001 marked this pull request as draft August 6, 2024 15:32
@red-001 red-001 force-pushed the tga_low_bit_image branch 2 times, most recently from e1e23f1 to 7e5a6a9 Compare August 6, 2024 19:16
@red-001 red-001 marked this pull request as ready for review August 6, 2024 19:16
@red-001 red-001 force-pushed the tga_low_bit_image branch from 7e5a6a9 to 1dadb9b Compare August 6, 2024 19:16
The decoder does the same thing as the BMP decoder, and converts 16-bit images to 32-bit ones on load.
@sophie-h
Copy link
Contributor

Is there anything missing to merge this? This appeared in the GdkPixbuf tests https://gitlab.gnome.org/GNOME/glycin/-/issues/147

@fintelia
Copy link
Contributor

I think it is a matter of rebasing and then doing a full read-through of the TGA decoder to double check that the rest of the code isn't making assumptions that've been broken.

@nickbabcock
Copy link

There is a bit of a correctness issue here.

The tga implementation assumes that the pixel attributes bits represent the alpha channel, but for images that lack the TGA 2.0 extension area, it is ambiguous how to interpret these bits, as these bits could also be interpreted as overlay data.

This PR assumes a pixel attribute bit of 0 is equivalent to alpha=0, which yields fully transparent images where imagemagick, paint.net, and other image viewers are opaque as they either skip this data or assume it to be overlay data, and 0 means opaque.

The issue is apparent in this PR for the utc16.tga. The committed testsuite file is fully transparent, but it should be opaque.

To be conformant with the ecosystem, this single bit attribute should be skipped (ie: R5_G5_B5_COLOR_MASK should be used in all situations)

@197g 197g added the kind: new features An operation that does not exist yet, add draft tag if appropriate label Aug 18, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind: new features An operation that does not exist yet, add draft tag if appropriate

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

5 participants