This commit is contained in:
Iliyan Angelov
2025-12-01 06:50:10 +02:00
parent 91f51bc6fe
commit 62c1fe5951
4682 changed files with 544807 additions and 31208 deletions

View File

@@ -18,6 +18,7 @@
#
# See the README file for information on usage and redistribution.
#
from __future__ import annotations
from . import Image, ImageFile
from ._binary import i16le as i16
@@ -26,8 +27,8 @@ from ._binary import i16le as i16
# helpers
def _accept(prefix):
return prefix[:4] == b"\200\350\000\000"
def _accept(prefix: bytes) -> bool:
return prefix.startswith(b"\200\350\000\000")
##
@@ -38,8 +39,10 @@ class PixarImageFile(ImageFile.ImageFile):
format = "PIXAR"
format_description = "PIXAR raster image"
def _open(self):
def _open(self) -> None:
# assuming a 4-byte magic label
assert self.fp is not None
s = self.fp.read(4)
if not _accept(s):
msg = "not a PIXAR file"
@@ -58,7 +61,7 @@ class PixarImageFile(ImageFile.ImageFile):
# FIXME: to be continued...
# create tile descriptor (assuming "dumped")
self.tile = [("raw", (0, 0) + self.size, 1024, (self.mode, 0, 1))]
self.tile = [ImageFile._Tile("raw", (0, 0) + self.size, 1024, self.mode)]
#