mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-04-22 18:21:59 +03:00
commit
7700293438
|
@ -4,6 +4,8 @@ import pytest
|
|||
|
||||
from PIL import GdImageFile, UnidentifiedImageError
|
||||
|
||||
from .helper import assert_image_similar_tofile
|
||||
|
||||
TEST_GD_FILE = "Tests/images/hopper.gd"
|
||||
|
||||
|
||||
|
@ -11,6 +13,7 @@ def test_sanity() -> None:
|
|||
with GdImageFile.open(TEST_GD_FILE) as im:
|
||||
assert im.size == (128, 128)
|
||||
assert im.format == "GD"
|
||||
assert_image_similar_tofile(im.convert("RGB"), "Tests/images/hopper.jpg", 14)
|
||||
|
||||
|
||||
def test_bad_mode() -> None:
|
||||
|
|
|
@ -56,7 +56,7 @@ class GdImageFile(ImageFile.ImageFile):
|
|||
msg = "Not a valid GD 2.x .gd file"
|
||||
raise SyntaxError(msg)
|
||||
|
||||
self._mode = "L" # FIXME: "P"
|
||||
self._mode = "P"
|
||||
self._size = i16(s, 2), i16(s, 4)
|
||||
|
||||
true_color = s[6]
|
||||
|
@ -68,14 +68,14 @@ class GdImageFile(ImageFile.ImageFile):
|
|||
self.info["transparency"] = tindex
|
||||
|
||||
self.palette = ImagePalette.raw(
|
||||
"XBGR", s[7 + true_color_offset + 4 : 7 + true_color_offset + 4 + 256 * 4]
|
||||
"RGBX", s[7 + true_color_offset + 6 : 7 + true_color_offset + 6 + 256 * 4]
|
||||
)
|
||||
|
||||
self.tile = [
|
||||
ImageFile._Tile(
|
||||
"raw",
|
||||
(0, 0) + self.size,
|
||||
7 + true_color_offset + 4 + 256 * 4,
|
||||
7 + true_color_offset + 6 + 256 * 4,
|
||||
"L",
|
||||
)
|
||||
]
|
||||
|
|
Loading…
Reference in New Issue
Block a user