[Image-SIG] Re: PIL && JPG => cannot identify image file PROBLEM

Fredrik Lundh fredrik at pythonware.com
Mon Jul 19 19:08:43 CEST 2004


Viktor Lacina wrote:

> That's probably the same situation as PIL, at finaly the problem is, that
> picture is taken by relatively new pice of digital camera from OLUMPUS which
> has set on EXIFII file format. PIL looks like supports older(first) version
> of EXIF (and by source code, only experimentaly).

looks like your camera is adding junk to the JPEG stream; I've attached a patch
that solves this specific problem.

regards /F

Index: PIL/JpegImagePlugin.py
===================================================================
--- PIL/JpegImagePlugin.py      (revision 1923)
+++ PIL/JpegImagePlugin.py      (working copy)
@@ -271,8 +271,8 @@
                     # self.__offset = self.fp.tell()
                     break
                 s = self.fp.read(1)
-            elif i == 65535:
-                # padded marker; move on
+            elif i == 0 or i == 65535:
+                # padded marker or junk; move on
                 s = "\xff"
             else:
                 raise SyntaxError("no marker found")





More information about the Image-SIG mailing list