Skip to content

If TGA v2 extension area specifies no alpha, fill alpha channel#9478

Merged
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:tga_alpha
Mar 26, 2026
Merged

If TGA v2 extension area specifies no alpha, fill alpha channel#9478
hugovk merged 1 commit intopython-pillow:mainfrom
radarhere:tga_alpha

Conversation

@radarhere
Copy link
Copy Markdown
Member

Resolves #9473

Using https://www.fileformat.info/format/tga/egff.htm as a reference, I found that v2 TGA files may has a 26 byte footer at the end of the file. The first 4 bytes point to the 'extension area', the last byte of which is 'AttributesType'. If this is zero, then the file should not has any alpha.

To avoid seeking to the end of the file during open), I'm only checking this value in load_end(), and filling the alpha channel at that point.

@hugovk hugovk merged commit 051fb0b into python-pillow:main Mar 26, 2026
56 checks passed
@radarhere radarhere deleted the tga_alpha branch March 26, 2026 21:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Transparent images don't seem to be handled correctly

2 participants