mirror of
https://github.com/python-pillow/Pillow.git
synced 2025-01-26 17:24:31 +03:00
refactor out postprocessing hack to load_end in PcdImageFile
This commit is contained in:
parent
a7ce2b69ca
commit
8dd19e6c33
|
@ -243,12 +243,6 @@ class ImageFile(Image.Image):
|
|||
# still raised if decoder fails to return anything
|
||||
raise_ioerror(err_code)
|
||||
|
||||
# post processing
|
||||
if hasattr(self, "tile_post_rotate"):
|
||||
# FIXME: This is a hack to handle rotated PCD's
|
||||
self.im = self.im.rotate(self.tile_post_rotate)
|
||||
self.size = self.im.size
|
||||
|
||||
self.load_end()
|
||||
|
||||
return Image.Image.load(self)
|
||||
|
|
|
@ -42,6 +42,7 @@ class PcdImageFile(ImageFile.ImageFile):
|
|||
raise SyntaxError("not a PCD file")
|
||||
|
||||
orientation = i8(s[1538]) & 3
|
||||
self.tile_post_rotate = None
|
||||
if orientation == 1:
|
||||
self.tile_post_rotate = 90 # hack
|
||||
elif orientation == 3:
|
||||
|
@ -51,6 +52,13 @@ class PcdImageFile(ImageFile.ImageFile):
|
|||
self.size = 768, 512 # FIXME: not correct for rotated images!
|
||||
self.tile = [("pcd", (0, 0)+self.size, 96*2048, None)]
|
||||
|
||||
def load_end(self):
|
||||
if self.tile_post_rotate:
|
||||
# Handle rotated PCDs
|
||||
self.im = self.im.rotate(self.tile_post_rotate)
|
||||
self.size = self.im.size
|
||||
|
||||
|
||||
#
|
||||
# registry
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user