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

@@ -16,6 +16,7 @@
# To do:
# FIXME: make save work (this requires quantization support)
#
from __future__ import annotations
from . import Image, ImageFile, ImagePalette
from ._binary import o8
@@ -32,8 +33,8 @@ for r in range(8):
)
def _accept(prefix):
return prefix[:6] == _MAGIC
def _accept(prefix: bytes) -> bool:
return prefix.startswith(_MAGIC)
##
@@ -44,8 +45,10 @@ class XVThumbImageFile(ImageFile.ImageFile):
format = "XVThumb"
format_description = "XV thumbnail image"
def _open(self):
def _open(self) -> None:
# check magic
assert self.fp is not None
if not _accept(self.fp.read(6)):
msg = "not an XV thumbnail file"
raise SyntaxError(msg)
@@ -70,7 +73,9 @@ class XVThumbImageFile(ImageFile.ImageFile):
self.palette = ImagePalette.raw("RGB", PALETTE)
self.tile = [("raw", (0, 0) + self.size, self.fp.tell(), (self.mode, 0, 1))]
self.tile = [
ImageFile._Tile("raw", (0, 0) + self.size, self.fp.tell(), self.mode)
]
# --------------------------------------------------------------------