Skip to content

Commit

Permalink
Merge pull request #1843 from radarhere/pixar
Browse files Browse the repository at this point in the history
Added _accept hook for PixarImagePlugin
  • Loading branch information
wiredfool committed Apr 19, 2016
2 parents 7938202 + 5319780 commit 2eea827
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions PIL/PixarImagePlugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
i16 = _binary.i16le


def _accept(prefix):
return prefix[:4] == b"\200\350\000\000"


##
# Image plugin for PIXAR raster images.

Expand All @@ -39,7 +43,7 @@ class PixarImageFile(ImageFile.ImageFile):

def _open(self):

# assuming a 4-byte magic label (FIXME: add "_accept" hook)
# assuming a 4-byte magic label
s = self.fp.read(4)
if s != b"\200\350\000\000":
raise SyntaxError("not a PIXAR file")
Expand All @@ -62,6 +66,6 @@ def _open(self):
#
# --------------------------------------------------------------------

Image.register_open(PixarImageFile.format, PixarImageFile)
Image.register_open(PixarImageFile.format, PixarImageFile, _accept)

Image.register_extension(PixarImageFile.format, ".pxr")

0 comments on commit 2eea827

Please sign in to comment.