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

Viktor Lacina viktor at lacina.org
Wed Jul 21 13:42:28 CEST 2004


tnx a lot.
I'm not sure if it's only occasional problem, because i found 3 cameras until 
now which produces this type of jpegs... and it grows :-) ...we have a lot of 
customers with digital cameras... at final aprox 1 new camera per week ...

maybe it's not bad idea to include this patch to next release.

Viktor


On Monday 19 of July 2004 19:08, Fredrik Lundh wrote:
> Viktor Lacina wrote:
> > That's probably the same situation as PIL, at finaly the problem isof, 
that
> > picture is taken by relatively new pice of digital camera from OLUot MPUS
> > 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")
>
>
>
> _______________________________________________
> Image-SIG maillist  -  Image-SIG at python.org
> http://mail.python.org/mailman/listinfo/image-sig


More information about the Image-SIG mailing list