Prevent opening P TGA images without a palette by radarhere · Pull Request #7797 · python-pillow/Pillow
Navigation Menu
- Notifications You must be signed in to change notification settings
- Fork 2.4k
Conversation
Using http://www.paulbourke.net/dataformats/tga/ as the TGA specification, this PR makes two changes
- Tests/images/dilation4.lut has
colormaptypeset 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. - 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
changed the title
Prevent P TGA images without a palette
Prevent opening P TGA images without a palette
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters