## The Python Imaging Library.# $Id$## PCD file handling## History:# 96-05-10 fl Created# 96-05-27 fl Added draft mode (128x192, 256x384)## Copyright (c) Secret Labs AB 1997.# Copyright (c) Fredrik Lundh 1996.## See the README file for information on usage and redistribution.#from__future__importannotationsfrom.importImage,ImageFile### Image plugin for PhotoCD images. This plugin only reads the 768x512# image from the file; higher resolutions are encoded in a proprietary# encoding.
[docs]classPcdImageFile(ImageFile.ImageFile):format="PCD"format_description="Kodak PhotoCD"def_open(self)->None:# roughassertself.fpisnotNoneself.fp.seek(2048)s=self.fp.read(2048)ifs[:4]!=b"PCD_":msg="not a PCD file"raiseSyntaxError(msg)orientation=s[1538]&3self.tile_post_rotate=Noneiforientation==1:self.tile_post_rotate=90eliforientation==3:self.tile_post_rotate=-90self._mode="RGB"self._size=768,512# FIXME: not correct for rotated images!self.tile=[ImageFile._Tile("pcd",(0,0)+self.size,96*2048,None)]