Skip to content

Conversation

@radarhere
Copy link
Member

Using http://www.paulbourke.net/dataformats/tga/ as the TGA specification, this PR makes two changes

  1. Tests/images/dilation4.lut has colormaptype set to zero, indicating that it does not have a color map. According to "DATA TYPE 1: Color-mapped images" in the spec though, when "Image Type Code" (imagetype) is 1, which it is, then the image is "DATA TYPE 1" and "Color Map Type" should be 1. So this image is actually invalid. This PR will be more flexible though, and just set the image mode to L instead of P, due to the lack of palette.
  2. In the spec, "Color Map Entry Size" is listed as "16 for the Targa 16, 24 for the Targa 24, 32 for the Targa 32." This PR raises an error if it is any other value. I created image for this through modifying p_16.tga by hand.
@radarhere radarhere changed the title Prevent P TGA images without a palette Prevent opening P TGA images without a palette Feb 13, 2024
@hugovk hugovk merged commit d8c8075 into python-pillow:main Mar 11, 2024
@radarhere radarhere deleted the tga_palette branch March 12, 2024 00:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

2 participants