Commits

Fredrik Lundh committed 348abb5 Merge

Merged in trunk.

  • Participants
  • Parent commits e5bed5e, e22a496
  • Branches openexr

Comments (0)

Files changed (243)

 *.pyc
 *.obj
 PIL/*.pyd
-build/*/Release/*
+PIL/*.so
+build/*
+dist/*
 
+
-770a9717f387cb878fc44b0e9be88e677b9abcd3 pil-116
-7493ffdf4aff81dfcf263ea90688f7ae81ae02a7 pil-117-20090309
-874f7005c34c0d4d8a7e21a4a2cd92f28be0ac40 pil-117-20090313
+770a9717f387cb878fc44b0e9be88e677b9abcd3 pil-116
+7493ffdf4aff81dfcf263ea90688f7ae81ae02a7 pil-117a1-20090309
+874f7005c34c0d4d8a7e21a4a2cd92f28be0ac40 pil-117a1-20090313
+454b4d2672f38b368713d1f3365c6fff62597620 pil-117a1-20090317
+57408fc8e0eeedf52317cdf054e7cb5563b3e889 pil-117a2-20090328
+8bde0398266e8092d857ef22b23f2c431a405f22 pil-117b1-20090412
+d6a2c141556383ed98efd90709f243885e038525 pil-117b2-20090801
+1098bb18b1c557c9a4a6a2298332cdd3edaa8165 pil-117c1-20091101
+4a8cdcc1da7433736050c091b4a8a9f6eee070bd pil-117-20091115
+f356a1f64271e9d3206fcf9059492ba1c9e163d6 pil-117
-# $Id: BUILDME 1998 2004-09-10 01:31:07Z fredrik $
+# $Id$
 # quick build (for lazy programmers).  for more information on the
 # build process, see the README file.
 
+if [ "$1" = "clean" ]; then
+  python setup.py clean
+  rm -f *.so PIL/*.so
+fi
+
 python setup.py build_ext -i
 python selftest.py
 rem # $Id$
-rem # call DISTCLEAN
+rem # quick windows build (for lazy programmers).  for more
+rem # information on the build process, see the README file.
+if not "%1" == "clean" goto :build
+  python setup.py clean
+  erase PIL\*.pyd
+:build
 python setup.py build_ext -i
-upx --best PIL/*.pyd
+rem # upx --best PIL\*.pyd
 The Python Imaging Library
 $Id$
 
-ACKNOWLEDGEMENTS: PIL wouldn't be what it is without the help of,
-among others: David Ascher, Phil Austin, Douglas Bagnall, Larry Bates,
-Anthony Baxter, William Baxter, Denis Benoit, Jan Blom, Duncan Booth,
-Jeff Breidenbach, Roger Burnham, Gene Cash, Kevin Cazabon, Fred Clare,
-Greg Coats, Chris Cogdon, Greg Couch, Bill Crutchfield, Abel Deuring,
-Tim Docker, Fred Drake, Graham Dumpleton, Matthew Ellis, Eric
-Etheridge, Robin Friedrich, Pier Paolo Glave, Federico Di Gregorio,
-Markus Gritsch, Daniel Haertle, Greg Hamilton, Mark Hammond, Bernhard
-Herzog, Rob Hooft, Bob Ippolito, Jack Jansen, Bill Janssen, Edward
-Jones, Richard Jones, Håkan Karlsson, Robert Kern, David Kirtley, Bob
-Klimek, Matthias Klose, Andrew Kuchling, Magnus Källström, Victor
-Lacina, Ben Last, Hamish Lawson, Cesare Leonardi, Andrew MacIntyre,
-Jan Matejek, Naveen Michaud-Agrawal, Gordon McMillan, Skip Montanaro,
-Fredrik Nehr, Russell Nelson, Luciano Nocera, Travis Oliphant, Piet
-van Oostrum, Richard Oudkerk, Paul Pharr, Andres Polit, Eric Raymond,
-Victor Reijs, Bertil Reinhammar, Nicholas Riley, Don Rozenberg, Toby
-Sargeant, Barry Scott, Les Schaffer, Joel Shprentz, Klamer Shutte,
-Gene Skonicki, Niki Spahiev, D. Alan Stewart, Perry Stoll, Paul
-Svensson, Ulrik Svensson, Miki Tebeka, Ivan Tkatchev, Dan Torop, Adam
-Twardoch, Rune Uhlin, Dmitry Vasiliev, Sasha Voynow, Charles Waldman,
-Dan Wolfe, and Ka-Ping Yee.
+ACKNOWLEDGEMENTS: PIL wouldn't be what it is without the help of:
+David Ascher, Phil Austin, Douglas Bagnall, Larry Bates, Anthony
+Baxter, William Baxter, Denis Benoit, Jan Blom, Duncan Booth, Alexey
+Borzenkov, Jeff Breidenbach, Roger Burnham, Zac Burns, Gene Cash,
+Kevin Cazabon, Fred Clare, Greg Coats, Chris Cogdon, Greg Couch, Bill
+Crutchfield, Abel Deuring, Tim Docker, Fred Drake, Graham Dumpleton,
+Matthew Ellis, Eric Etheridge, Daniel Fetchinson, Robin Friedrich,
+Pier Paolo Glave, Federico Di Gregorio, Markus Gritsch, Daniel
+Haertle, Greg Hamilton, Mark Hammond, Bernhard Herzog, Rob Hooft, Bob
+Ippolito, Jack Jansen, Bill Janssen, Edward Jones, Richard Jones,
+Håkan Karlsson, Robert Kern, David Kirtley, Bob Klimek, Matthias
+Klose, Andrew Kuchling, Magnus Källström, Victor Lacina, Ben Last,
+Hamish Lawson, Cesare Leonardi, Andrew MacIntyre, Jan Matejek, Naveen
+Michaud-Agrawal, Gordon McMillan, Skip Montanaro, Fredrik Nehr,
+Russell Nelson, Luciano Nocera, Travis Oliphant, Piet van Oostrum,
+Richard Oudkerk, Paul Pharr, Andres Polit, Conrado Porto Lopes Gouvêa,
+Eric Raymond, Victor Reijs, Bertil Reinhammar, Nicholas Riley, Don
+Rozenberg, Toby Sargeant, Barry Scott, Les Schaffer, Joel Shprentz,
+Klamer Shutte, Gene Skonicki, Niki Spahiev, D. Alan Stewart, Perry
+Stoll, Paul Svensson, Ulrik Svensson, Miki Tebeka, Michael van
+Tellingen, Ivan Tkatchev, Dan Torop, Adam Twardoch, Rune Uhlin, Dmitry
+Vasiliev, Sasha Voynow, Charles Waldman, Collin Winter, Dan Wolfe,
+Ka-Ping Yee, and many others (if your name should be on this list, let
+me know.)
+
+*** Changes from release 1.1.7 to 1.1.8 ***
+
+This section may not be fully complete.  For changes since this file
+was last updated, see the repository revision history:
+
+  http://bitbucket.org/effbot/pil-2009-raclette/changesets/
+
++ Added support for reading 16-bit RGB TIFF file.
+
++ Fixed numpy conversion for YCbCr images (from David Coles).
 
 *** Changes from release 1.1.6 to 1.1.7 ***
 
-This section is not complete.  For changes since this file was last
-updated, see the repository revision history:
-
-  http://bitbucket.org/effbot/pil-2009-raclette/changesets/
-
-Partial history (last updated 2009-03-13):
-
-Added version query mechanism to ImageCms and ImageFont, for debugging.
-
-Added (experimental) ImageCms function for fetching the ICC profile
-for the current display (currently Windows only).
+(1.1.7 final)
+
++ Set GIF loop info property to the number of iterations if a NETSCAPE
+  loop extension is present, instead of always setting it to 1 (from
+  Valentino Volonghi).
+
+(1.1.7c1 released)
+
++ Improved PNG compression (from Alexey Borzenkov).
+
++ Read interlaced PNG files (from Conrado Porto Lopes Gouvêa)
+
++ Added various TGA improvements from Alexey Borzenkov, including
+  support for specifying image orientation.
+
++ Bumped block threshold to 16 megabytes, made size estimation a bit
+  more accurate.  This speeds up allocation of large images.
+
++ Fixed rounding error in ImagingDrawWideLine.
+
+  "gormish" writes: ImagingDrawWideLine() in Draw.c has a bug in every
+  version I've seen, which leads to different width lines depending on
+  the order of the points in the line. This is especially bad at some
+  angles where a 'width=2' line can completely disappear.
+
++ Added support for RGBA mode to the SGI module (based on code by
+  Karsten Hiddemann).
+
++ Handle repeated IPTC tags (adapted from a patch by Eric Bruning).
+
+  Eric writes: According to the specification, some IPTC tags can be
+  repeated, e.g., tag 2:25 (keywords). PIL 1.1.6 only retained the last
+  instance of that tag. Below is a patch to store all tags. If there are
+  multiple tag instances, they are stored in a (python) list. Single tag
+  instances remain as strings.
+
++ Fixed potential crash in ImageFilter for small target images
+  (reported by Zac Burns and Daniel Fetchinson).
+
++ Use BMP instead of JPEG as temporary show format on Mac OS X.
+
++ Fixed putpixel/new for I;16 with colors > 255.
+
++ Added integer power support to ImagingMath.
+
++ Added limited support for I;16L mode (explicit little endian).
+
++ Moved WMF support into Image.core; enable WMF rendering by default
+  if renderer is available.
+
++ Mark the ARG plugin as obsolete.
+
++ Added version query mechanism to ImageCms and ImageFont, for
+  debugging.
+
++ Added (experimental) ImageCms function for fetching the ICC profile
+  for the current display (currently Windows only).
 
   Added HWND/HDC support to ImageCms.get_display_profile().
 
-Added WMF renderer (Windows only).
-
-Added ImagePointHandler and ImageTransformHandler mixins; made
-ImageCmsTransform work with im.point.
-
-Fixed potential endless loop in the XVThumbnail reader (from Nikolai
-Ugelvik).
-
-Added Kevin Cazabon's pyCMS package.
++ Added WMF renderer (Windows only).
+
++ Added ImagePointHandler and ImageTransformHandler mixins; made
+  ImageCmsTransform work with im.point.
+
++ Fixed potential endless loop in the XVThumbnail reader (from Nikolai
+  Ugelvik).
+
++ Added Kevin Cazabon's pyCMS package.
 
   The C code has been moved to _imagingcms.c, the Python interface
   module is installed as PIL.ImageCMS.
     wording), so I changed variable names and docstrings where
     applicable. Patches are tested under Python 2.6.
 
-Improved support for layer names in PSD files (from Sylvain Baubeau)
++ Improved support for layer names in PSD files (from Sylvain Baubeau)
 
   Sylvain writes: I needed to be able to retrieve the names of the
   layers in a PSD files. But PsdImagePlugin.py didn't do the job so I
   wrote this very small patch.
 
-Improved RGBA support for ImageTk for 8.4 and newer (from Con Radchenko).
++ Improved RGBA support for ImageTk for 8.4 and newer (from Con
+  Radchenko).
 
   This replaces the slow run-length based encoding model with true
   compositing at the Tk level.
 
-Added support for 16- and 32-bit images to McIdas loader.
++ Added support for 16- and 32-bit images to McIdas loader.
 
   Based on file samples and stand-alone reader code provided by Craig
   Swank.
 
-Added ImagePalette support to putpalette.
-
-Fixed problem with incremental parsing of PNG files.
-
-Make selftest.py report non-zero status on failure (from Mark Sienkiewicz)
-
-Add big endian save support and multipage infrastructure to the TIFF
-writer (from Sebastian Haase).
-
-Added zTXT support (from Andrew Kuchling via Lowell Alleman).
-
-Fixed potential infinite loop bug in ImageFont (from Guilherme Polo).
-
-Added sample ICC profiles (from Kevin Cazabon)
-
-Fixed array interface for I, F, and RGBA/RGBX images.
-
-Added Chroma subsampling support for JPEG (from Justin Huff).
++ Added ImagePalette support to putpalette.
+
++ Fixed problem with incremental parsing of PNG files.
+
++ Make selftest.py report non-zero status on failure (from Mark
+  Sienkiewicz)
+
++ Add big endian save support and multipage infrastructure to the TIFF
+  writer (from Sebastian Haase).
+
++ Handle files with GPS IFD but no basic EXIF IFD (reported by Kurt
+  Schwehr).
+
++ Added zTXT support (from Andrew Kuchling via Lowell Alleman).
+
++ Fixed potential infinite loop bug in ImageFont (from Guilherme Polo).
+
++ Added sample ICC profiles (from Kevin Cazabon)
+
++ Fixed array interface for I, F, and RGBA/RGBX images.
+
++ Added Chroma subsampling support for JPEG (from Justin Huff).
 
   Justin writes: Attached is a patch (against PIL 1.1.6) to provide
   control over the chroma subsampling done by the JPEG encoder.  This
   is often useful for reducing compression artifacts around edges of
   clipart and text.
 
-Added USM/Gaussian Blur code from Kevin Cazabon.
-
-Fixed bug w. uninitialized image data when cropping outside the source image.
-
-Use ImageShow to implement the Image.show method.
++ Added USM/Gaussian Blur code from Kevin Cazabon.
+
++ Fixed bug w. uninitialized image data when cropping outside the
+  source image.
+
++ Use ImageShow to implement the Image.show method.
 
   Most notably, this picks the 'display' utility when available.  It
   also allows application code to register new display utilities via
   the ImageShow registry.
 
-Release the GIL in the PNG compressor (from Michael van Tellingen).
-
-Revised JPEG CMYK handling.
++ Release the GIL in the PNG compressor (from Michael van Tellingen).
+
++ Revised JPEG CMYK handling.
 
   Always assume Adobe behaviour, both when reading and writing (based on
-  a patch by Kevin Cazabon, and test data by Tim V. and Charlie Clark).
-
-Support for preserving ICC profiles (by Florian Böch via Tim Hatch).
+  a patch by Kevin Cazabon, and test data by Tim V. and Charlie Clark, and
+  additional debugging by Michael van Tellingen).
+
++ Support for preserving ICC profiles (by Florian Böch via Tim Hatch).
 
   Florian writes:
 
   metadata when saving as TIFF again, read/write TIFF resolution
   information correctly, and to correct inverted CMYK JPEG files.
 
-Fixed potential memory leak in median cut quantizer (from Evgeny Salmin).
-
-Fixed OverflowError when reading upside-down BMP images.
-
-Added resolution save option for PDF files.
++ Fixed potential memory leak in median cut quantizer (from Evgeny Salmin).
+
++ Fixed OverflowError when reading upside-down BMP images.
+
++ Added resolution save option for PDF files.
 
   Andreas Kostyrka writes: I've included a patched PdfImagePlugin.py
   based on 1.1.6 as included in Ubuntu, that supports a "resolution"
   save option. Not great, but it makes the PDF saving more useful by
   allowing PDFs that are not exactly 72dpi.
 
-Look for Tcl/Tk include files in version-specific include directory
-(from Encolpe Degoute).
-
-Fixed grayscale rounding error in ImageColor.getcolor (from Tim
-Hatch).
-
-Fixed truetype positioning when first character has a negative left
-bearing (from Ned Batchelder):
++ Look for Tcl/Tk include files in version-specific include directory
+  (from Encolpe Degoute).
+
++ Fixed grayscale rounding error in ImageColor.getcolor (from Tim
+  Hatch).
+
++ Fixed calculation of mean value in ImageEnhance.Contrast (reported
+  by "roop" and Scott David Daniels).
+
++ Fixed truetype positioning when first character has a negative left
+  bearing (from Ned Batchelder):
 
   Ned writes: In PIL 1.1.6, ImageDraw.text will position the string
   incorrectly if the first character has a negative left bearing.  To
   first slash will be clipped at the left, and the string will be
   mis-positioned.
 
-Fixed resolution unit bug in tiff reader/writer (from Florian Höch,
-Gary Bloom, and others).
-
-Added simple transparency support for RGB images (reported by
-Sebastian Spaeth).
-
-Added support for Unicode filenames in ImageFont.truetype (from Donn
-Ingle).
-
-Fixed potential crash in ImageFont.getname method (from Donn Ingle).
-
-Fixed encoding issue in PIL/WalImageFile (from Santiago M. Mola).
++ Fixed resolution unit bug in tiff reader/writer (based on code by
+  Florian Höch, Gary Bloom, and others).
+
++ Added simple transparency support for RGB images (reported by
+  Sebastian Spaeth).
+
++ Added support for Unicode filenames in ImageFont.truetype (from Donn
+  Ingle).
+
++ Fixed potential crash in ImageFont.getname method (from Donn Ingle).
+
++ Fixed encoding issue in PIL/WalImageFile (from Santiago M. Mola).
 
 *** Changes from release 1.1.5 to 1.1.6 ***
 
 Imaging/PIL/BdfFontFile.py
 Imaging/PIL/BmpImagePlugin.py
 Imaging/PIL/BufrStubImagePlugin.py
+Imaging/PIL/ByteArray.py
 Imaging/PIL/ContainerIO.py
 Imaging/PIL/CurImagePlugin.py
 Imaging/PIL/DcxImagePlugin.py
 Imaging/PIL/ImageSequence.py
 Imaging/PIL/ImageShow.py
 Imaging/PIL/ImageStat.py
+Imaging/PIL/ImageString.py
 Imaging/PIL/ImageTk.py
 Imaging/PIL/ImageTransform.py
 Imaging/PIL/ImageWin.py
 Imaging/Scripts/pilprint.py
 
 Imaging/Images/lena.gif
+Imaging/Images/lena.png
 Imaging/Images/lena.ppm
 Imaging/Images/lena.jpg
 

File Images/lena.png

Old
Old image
New
New image

File MANIFEST

-README
-CHANGES
-CONTENTS
-MANIFEST
-BUILDME
-setup.py
-selftest.py
-doctest.py
-libImaging/Imaging.h
-libImaging/ImDib.h
-libImaging/ImPlatform.h
-libImaging/Quant.h
-libImaging/QuantHash.h
-libImaging/QuantHeap.h
-libImaging/QuantDefines.h
-libImaging/QuantTypes.h
-libImaging/Access.c
-libImaging/Antialias.c
-libImaging/Bands.c
-libImaging/Blend.c
-libImaging/Chops.c
-libImaging/Convert.c
-libImaging/ConvertYCbCr.c
-libImaging/Copy.c
-libImaging/Crc32.c
-libImaging/Crop.c
-libImaging/Dib.c
-libImaging/Draw.c
-libImaging/Effects.c
-libImaging/Except.c
-libImaging/File.c
-libImaging/Fill.c
-libImaging/Filter.c
-libImaging/Geometry.c
-libImaging/GetBBox.c
-libImaging/Histo.c
-libImaging/Matrix.c
-libImaging/ModeFilter.c
-libImaging/Negative.c
-libImaging/Offset.c
-libImaging/Pack.c
-libImaging/Palette.c
-libImaging/Paste.c
-libImaging/Point.c
-libImaging/Quant.c
-libImaging/QuantHash.c
-libImaging/QuantHeap.c
-libImaging/RankFilter.c
-libImaging/Storage.c
-libImaging/Unpack.c
-libImaging/UnpackYCC.c
-libImaging/Bit.h
-libImaging/Gif.h
-libImaging/Jpeg.h
-libImaging/Lzw.h
-libImaging/Raw.h
-libImaging/Zip.h
-libImaging/BitDecode.c
-libImaging/EpsEncode.c
-libImaging/FliDecode.c
-libImaging/GifDecode.c
-libImaging/GifEncode.c
-libImaging/HexDecode.c
-libImaging/JpegDecode.c
-libImaging/JpegEncode.c
-libImaging/LzwDecode.c
-libImaging/MspDecode.c
-libImaging/PackDecode.c
-libImaging/PcdDecode.c
-libImaging/PcxEncode.c
-libImaging/PcxDecode.c
-libImaging/RawDecode.c
-libImaging/RawEncode.c
-libImaging/SunRleDecode.c
-libImaging/TgaRleDecode.c
-libImaging/XbmDecode.c
-libImaging/XbmEncode.c
-libImaging/ZipDecode.c
-libImaging/ZipEncode.c
-_imaging.c
-decode.c
-encode.c
-display.c
-map.c
-outline.c
-path.c
-_imagingtk.c
-_imagingft.c
-_imagingmath.c
-PIL.pth
-PIL/__init__.py
-PIL/ArgImagePlugin.py
-PIL/BdfFontFile.py
-PIL/BmpImagePlugin.py
-PIL/BufrStubImagePlugin.py
-PIL/ContainerIO.py
-PIL/CurImagePlugin.py
-PIL/DcxImagePlugin.py
-PIL/EpsImagePlugin.py
-PIL/ExifTags.py
-PIL/FitsStubImagePlugin.py
-PIL/FliImagePlugin.py
-PIL/FontFile.py
-PIL/FpxImagePlugin.py
-PIL/GbrImagePlugin.py
-PIL/GdImageFile.py
-PIL/GifImagePlugin.py
-PIL/GimpGradientFile.py
-PIL/GimpPaletteFile.py
-PIL/GribStubImagePlugin.py
-PIL/Hdf5StubImagePlugin.py
-PIL/IcoImagePlugin.py
-PIL/IcnsImagePlugin.py
-PIL/Image.py
-PIL/ImageChops.py
-PIL/ImageColor.py
-PIL/ImageDraw.py
-PIL/ImageDraw2.py
-PIL/ImageEnhance.py
-PIL/ImageFile.py
-PIL/ImageFileIO.py
-PIL/ImageFilter.py
-PIL/ImageFont.py
-PIL/ImageGL.py
-PIL/ImageGrab.py
-PIL/ImageMath.py
-PIL/ImageMode.py
-PIL/ImageOps.py
-PIL/ImagePalette.py
-PIL/ImagePath.py
-PIL/ImageQt.py
-PIL/ImageSequence.py
-PIL/ImageStat.py
-PIL/ImageTk.py
-PIL/ImageTransform.py
-PIL/ImageWin.py
-PIL/ImImagePlugin.py
-PIL/ImtImagePlugin.py
-PIL/IptcImagePlugin.py
-PIL/JpegImagePlugin.py
-PIL/McIdasImagePlugin.py
-PIL/MicImagePlugin.py
-PIL/MpegImagePlugin.py
-PIL/MspImagePlugin.py
-PIL/OleFileIO.py
-PIL/PaletteFile.py
-PIL/PalmImagePlugin.py
-PIL/PcdImagePlugin.py
-PIL/PcfFontFile.py
-PIL/PcxImagePlugin.py
-PIL/PdfImagePlugin.py
-PIL/PixarImagePlugin.py
-PIL/PngImagePlugin.py
-PIL/PpmImagePlugin.py
-PIL/PsdImagePlugin.py
-PIL/PSDraw.py
-PIL/SgiImagePlugin.py
-PIL/SpiderImagePlugin.py
-PIL/SunImagePlugin.py
-PIL/TarIO.py
-PIL/TgaImagePlugin.py
-PIL/TiffImagePlugin.py
-PIL/TiffTags.py
-PIL/WalImageFile.py
-PIL/WmfImagePlugin.py
-PIL/XbmImagePlugin.py
-PIL/XpmImagePlugin.py
-PIL/XVThumbImagePlugin.py
-Docs/index.html
-Docs/effbot.css
-Docs/pythondoc-PIL.ArgImagePlugin.html
-Docs/pythondoc-PIL.BdfFontFile.html
-Docs/pythondoc-PIL.BmpImagePlugin.html
-Docs/pythondoc-PIL.BufrStubImagePlugin.html
-Docs/pythondoc-PIL.ContainerIO.html
-Docs/pythondoc-PIL.CurImagePlugin.html
-Docs/pythondoc-PIL.DcxImagePlugin.html
-Docs/pythondoc-PIL.EpsImagePlugin.html
-Docs/pythondoc-PIL.ExifTags.html
-Docs/pythondoc-PIL.FitsStubImagePlugin.html
-Docs/pythondoc-PIL.FliImagePlugin.html
-Docs/pythondoc-PIL.FontFile.html
-Docs/pythondoc-PIL.FpxImagePlugin.html
-Docs/pythondoc-PIL.GbrImagePlugin.html
-Docs/pythondoc-PIL.GdImageFile.html
-Docs/pythondoc-PIL.GifImagePlugin.html
-Docs/pythondoc-PIL.GimpGradientFile.html
-Docs/pythondoc-PIL.GimpPaletteFile.html
-Docs/pythondoc-PIL.GribStubImagePlugin.html
-Docs/pythondoc-PIL.Hdf5StubImagePlugin.html
-Docs/pythondoc-PIL.IcoImagePlugin.html
-Docs/pythondoc-PIL.IcnsImagePlugin.html
-Docs/pythondoc-PIL.Image.html
-Docs/pythondoc-PIL.ImageChops.html
-Docs/pythondoc-PIL.ImageColor.html
-Docs/pythondoc-PIL.ImageDraw.html
-Docs/pythondoc-PIL.ImageEnhance.html
-Docs/pythondoc-PIL.ImageFile.html
-Docs/pythondoc-PIL.ImageFileIO.html
-Docs/pythondoc-PIL.ImageFilter.html
-Docs/pythondoc-PIL.ImageFont.html
-Docs/pythondoc-PIL.ImageGL.html
-Docs/pythondoc-PIL.ImageGrab.html
-Docs/pythondoc-PIL.ImageOps.html
-Docs/pythondoc-PIL.ImagePalette.html
-Docs/pythondoc-PIL.ImagePath.html
-Docs/pythondoc-PIL.ImageSequence.html
-Docs/pythondoc-PIL.ImageStat.html
-Docs/pythondoc-PIL.ImageTk.html
-Docs/pythondoc-PIL.ImageTransform.html
-Docs/pythondoc-PIL.ImageWin.html
-Docs/pythondoc-PIL.ImImagePlugin.html
-Docs/pythondoc-PIL.ImtImagePlugin.html
-Docs/pythondoc-PIL.IptcImagePlugin.html
-Docs/pythondoc-PIL.JpegImagePlugin.html
-Docs/pythondoc-PIL.McIdasImagePlugin.html
-Docs/pythondoc-PIL.MicImagePlugin.html
-Docs/pythondoc-PIL.MpegImagePlugin.html
-Docs/pythondoc-PIL.MspImagePlugin.html
-Docs/pythondoc-PIL.OleFileIO.html
-Docs/pythondoc-PIL.PaletteFile.html
-Docs/pythondoc-PIL.PalmImagePlugin.html
-Docs/pythondoc-PIL.PcdImagePlugin.html
-Docs/pythondoc-PIL.PcfFontFile.html
-Docs/pythondoc-PIL.PcxImagePlugin.html
-Docs/pythondoc-PIL.PdfImagePlugin.html
-Docs/pythondoc-PIL.PixarImagePlugin.html
-Docs/pythondoc-PIL.PngImagePlugin.html
-Docs/pythondoc-PIL.PpmImagePlugin.html
-Docs/pythondoc-PIL.PsdImagePlugin.html
-Docs/pythondoc-PIL.PSDraw.html
-Docs/pythondoc-PIL.SgiImagePlugin.html
-Docs/pythondoc-PIL.SpiderImagePlugin.html
-Docs/pythondoc-PIL.SunImagePlugin.html
-Docs/pythondoc-PIL.TarIO.html
-Docs/pythondoc-PIL.TgaImagePlugin.html
-Docs/pythondoc-PIL.TiffImagePlugin.html
-Docs/pythondoc-PIL.TiffTags.html
-Docs/pythondoc-PIL.WalImageFile.html
-Docs/pythondoc-PIL.WmfImagePlugin.html
-Docs/pythondoc-PIL.XbmImagePlugin.html
-Docs/pythondoc-PIL.XpmImagePlugin.html
-Docs/pythondoc-PIL.XVThumbImagePlugin.html
-Scripts/pilconvert.py
-Scripts/pildriver.py
-Scripts/pilfile.py
-Scripts/pilfont.py
-Scripts/pilprint.py
-Images/lena.gif
-Images/lena.ppm
-Images/lena.jpg
-Images/courB08.bdf
-Images/courB08.pbm
-Images/courB08.pil
-Sane/README
-Sane/CHANGES
-Sane/setup.py
-Sane/sanedoc.txt
-Sane/_sane.c
-Sane/sane.py
-Sane/demo_numarray.py
-Sane/demo_pil.py
-Scripts/README
-Scripts/enhancer.py
-Scripts/explode.py
-Scripts/gifmaker.py
-Scripts/image2py.py
-Scripts/painter.py
-Scripts/player.py
-Scripts/viewer.py
-Scripts/thresholder.py
-Tk/tkImaging.c
-Tk/install.txt
-Tk/booster.txt
-Tk/pilbitmap.txt

File PIL/ArgImagePlugin.py

 # THIS IS WORK IN PROGRESS
 #
 # The Python Imaging Library.
-# $Id: ArgImagePlugin.py 2309 2005-03-02 15:06:34Z fredrik $
+# $Id$
 #
 # ARG animation support code
 #

File PIL/BdfFontFile.py

 #
 # The Python Imaging Library
-# $Id: BdfFontFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # bitmap distribution font (bdf) file parser
 #
 import Image
 import FontFile
 
-import string
+import ImageString
 
 # --------------------------------------------------------------------
 # parse X Bitmap Distribution Format (BDF)
             return None
         if s[:9] == "STARTCHAR":
             break
-    id = string.strip(s[9:])
+    id = s[9:].strip()
 
     # load symbol properties
     props = {}
         s = f.readline()
         if not s or s[:6] == "BITMAP":
             break
-        i = string.find(s, " ")
+        i = ImageString.find(s, " ")
         props[s[:i]] = s[i+1:-1]
 
     # load bitmap
         if not s or s[:7] == "ENDCHAR":
             break
         bitmap.append(s[:-1])
-    bitmap = string.join(bitmap, "")
+    bitmap = ImageString.join(bitmap, "")
 
-    [x, y, l, d] = map(int, string.split(props["BBX"]))
-    [dx, dy] = map(int, string.split(props["DWIDTH"]))
+    [x, y, l, d] = map(int, ImageString.split(props["BBX"]))
+    [dx, dy] = map(int, ImageString.split(props["DWIDTH"]))
 
     bbox = (dx, dy), (l, -d-y, x+l, -d), (0, 0, x, y)
 
 
         s = fp.readline()
         if s[:13] != "STARTFONT 2.1":
-            raise SyntaxError, "not a valid BDF file"
+            raise SyntaxError("not a valid BDF file")
 
         props = {}
         comments = []
             s = fp.readline()
             if not s or s[:13] == "ENDPROPERTIES":
                 break
-            i = string.find(s, " ")
+            i = ImageString.find(s, " ")
             props[s[:i]] = s[i+1:-1]
             if s[:i] in ["COMMENT", "COPYRIGHT"]:
-                if string.find(s, "LogicalFontDescription") < 0:
+                if ImageString.find(s, "LogicalFontDescription") < 0:
                     comments.append(s[i+1:-1])
 
-        font = string.split(props["FONT"], "-")
+        font = ImageString.split(props["FONT"], "-")
 
-        font[4] = bdf_slant[string.upper(font[4])]
-        font[11] = bdf_spacing[string.upper(font[11])]
+        font[4] = bdf_slant[font[4].upper()]
+        font[11] = bdf_spacing[font[11].upper()]
 
         ascent = int(props["FONT_ASCENT"])
         descent = int(props["FONT_DESCENT"])
 
-        fontname = string.join(font[1:], ";")
+        fontname = ImageString.join(font[1:], ";")
 
         # print "#", fontname
         # for i in comments:

File PIL/BmpImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: BmpImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # BMP file handler
 #
 __version__ = "0.7"
 
 
-import string
 import Image, ImageFile, ImagePalette
+import ImageString
 
 
 #
     1: ("P", "P;1"),
     4: ("P", "P;4"),
     8: ("P", "P"),
-    16: ("RGB", "BGR;16"),
+    16: ("RGB", "BGR;15"),
     24: ("RGB", "BGR"),
     32: ("RGB", "BGRX")
 }
 
         # CORE/INFO
         s = read(4)
-        s = s + ImageFile._safe_read(self.fp, i32(s)-4)
+        s = s + self.fp.saferead(i32(s)-4)
 
         if len(s) == 12:
 
             else:
                 self.mode = "P"
                 self.palette = ImagePalette.raw(
-                    "BGR", string.join(palette, "")
+                    "BGR", ImageString.join(palette, "")
                     )
 
         if not offset:

File PIL/BufrStubImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: BufrStubImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # BUFR stub adapter
 #

File PIL/ByteArray.py

+# byte array wrapper
+
+class ByteArray(object):
+
+    def __init__(self, data):
+        self.data = data
+
+    def __len__(self):
+        return len(self.data)
+
+    def __add__(self, other):
+        return ByteArray(self.data + other.data)
+
+    def __getitem__(self, i):
+        return ord(self.data[i])
+
+    def find(self, p):
+        return self.data.find(p)
+
+    def int16(self, i):
+        return self[i] + (self[i+1]<<8)
+
+    def int32(self, i):
+        return self[i] + (self[i+1]<<8) + (self[i+2]<<16) + (self[i+3]<<24)
+
+    def int16b(self, i):
+        return self[i+1] + (self[i]<<8)
+
+    def int32b(self, i):
+        return self[i+3] + (self[i+2]<<8) + (self[i+1]<<16) + (self[i]<<24)
+
+    def __getslice__(self, i, j):
+        return ByteArray(self.data[i:j])
+
+    def startswith(self, s):
+        return self.data[:len(s)] == s
+
+    def tostring(self):
+        return self.data
+
+    

File PIL/ContainerIO.py

 #
 # The Python Imaging Library.
-# $Id: ContainerIO.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # a class to read from a container file
 #
 # A file object that provides read access to a part of an existing
 # file (for example a TAR file).
 
-class ContainerIO:
+class ContainerIO(object):
 
     ##
     # Create file object.

File PIL/CurImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: CurImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # Windows Cursor support for PIL
 #
         # check magic
         s = self.fp.read(6)
         if not _accept(s):
-            raise SyntaxError, "not an CUR file"
+            raise SyntaxError("not an CUR file")
 
         # pick the largest cursor in the file
         m = ""

File PIL/DcxImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: DcxImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # DCX file handling
 #
         # Header
         s = self.fp.read(4)
         if i32(s) != MAGIC:
-            raise SyntaxError, "not a DCX file"
+            raise SyntaxError("not a DCX file")
 
         # Component directory
         self._offset = []

File PIL/EpsImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: EpsImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # EPS file handling
 #
 
 __version__ = "0.5"
 
-import re, string
+import re
 import Image, ImageFile
+import ImageString
 
 #
 # --------------------------------------------------------------------
                "-sOutputFile=%s" % file,# output file
                "- >/dev/null 2>/dev/null"]
 
-    command = string.join(command)
+    command = ImageString.join(command, " ")
 
     # push data through ghostscript
     try:
             length = i32(s[8:])
             fp.seek(offset)
         else:
-            raise SyntaxError, "not an EPS file"
+            raise SyntaxError("not an EPS file")
 
         fp.seek(offset)
 
         while s:
 
             if len(s) > 255:
-                raise SyntaxError, "not an EPS file"
+                raise SyntaxError("not an EPS file")
 
             if s[-2:] == '\r\n':
                 s = s[:-2]
             try:
                 m = split.match(s)
             except re.error, v:
-                raise SyntaxError, "not an EPS file"
+                raise SyntaxError("not an EPS file")
 
             if m:
                 k, v = m.group(1, 2)
                         # Note: The DSC spec says that BoundingBox
                         # fields should be integers, but some drivers
                         # put floating point values there anyway.
-                        box = map(int, map(float, string.split(v)))
+                        box = map(int, map(float, ImageString.split(v)))
                         self.size = box[2] - box[0], box[3] - box[1]
                         self.tile = [("eps", (0,0) + self.size, offset,
                                       (length, box))]
                     else:
                         self.info[k] = ""
                 else:
-                    raise IOError, "bad EPS header"
+                    raise IOError("bad EPS header")
 
             s = fp.readline()
 
         while s[0] == "%":
 
             if len(s) > 255:
-                raise SyntaxError, "not an EPS file"
+                raise SyntaxError("not an EPS file")
 
             if s[-2:] == '\r\n':
                 s = s[:-2]
 
             if s[:11] == "%ImageData:":
 
-                [x, y, bi, mo, z3, z4, en, id] =\
-                    string.split(s[11:], maxsplit=7)
+                [x, y, bi, mo, z3, z4, en, id] = s[11:].split(maxsplit=7)
 
                 x = int(x); y = int(y)
 
                 break
 
         if not box:
-            raise IOError, "cannot determine EPS bounding box"
+            raise IOError("cannot determine EPS bounding box")
 
     def load(self):
         # Load EPS via Ghostscript
     elif im.mode == "CMYK":
         operator = (8, 4, "false 4 colorimage")
     else:
-        raise ValueError, "image mode is not supported"
+        raise ValueError("image mode is not supported")
 
     if eps:
         #

File PIL/ExifTags.py

 #
 # The Python Imaging Library.
-# $Id: ExifTags.py 2631 2006-02-12 23:41:52Z fredrik $
+# $Id$
 #
 # EXIF tags
 #

File PIL/FitsStubImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: FitsStubImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # FITS stub adapter
 #

File PIL/FliImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: FliImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # FLI/FLC file handling.
 #
 __version__ = "0.2"
 
 import Image, ImageFile, ImagePalette
-import string
+import ImageString
 
 
 def i16(c):
         s = self.fp.read(128)
         magic = i16(s[4:6])
         if magic not in [0xAF11, 0xAF12]:
-            raise SyntaxError, "not an FLI/FLC file"
+            raise SyntaxError("not an FLI/FLC file")
 
         # image characteristics
         self.mode = "P"
                 self._palette(palette, 0)
 
         palette = map(lambda (r,g,b): chr(r)+chr(g)+chr(b), palette)
-        self.palette = ImagePalette.raw("RGB", string.join(palette, ""))
+        self.palette = ImagePalette.raw("RGB", ImageString.join(palette, ""))
 
         # set things up to decode first frame
         self.frame = -1
     def seek(self, frame):
 
         if frame != self.frame + 1:
-            raise ValueError, "cannot seek to frame %d" % frame
+            raise ValueError("cannot seek to frame %d" % frame)
         self.frame = frame
 
         # move to next frame

File PIL/FontFile.py

 #
 # The Python Imaging Library
-# $Id: FontFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # base class for raster font file parsers
 #
 ##
 # Base class for raster font file handlers.
 
-class FontFile:
+class FontFile(object):
 
     bitmap = None
 

File PIL/FpxImagePlugin.py

 # THIS IS WORK IN PROGRESS
 #
 # The Python Imaging Library.
-# $Id: FpxImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # FlashPix support for PIL
 #
         try:
             self.ole = OleFileIO(self.fp)
         except IOError:
-            raise SyntaxError, "not an FPX file; invalid OLE file"
+            raise SyntaxError("not an FPX file; invalid OLE file")
 
         if self.ole.root.clsid != "56616700-C154-11CE-8553-00AA00A1F95B":
-            raise SyntaxError, "not an FPX file; bad root CLSID"
+            raise SyntaxError("not an FPX file; bad root CLSID")
 
         self._open_index(1)
 
         # print size, self.mode, self.rawmode
 
         if size != self.size:
-            raise IOError, "subimage mismatch"
+            raise IOError("subimage mismatch")
 
         # get tile descriptors
         fp.seek(28 + offset)
                     self.tile_prefix = self.jpeg[jpeg_tables]
 
             else:
-                raise IOError, "unknown/invalid compression"
+                raise IOError("unknown/invalid compression")
 
             x = x + xtile
             if x >= xsize:

File PIL/GbrImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: GbrImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # load a GIMP brush file
 #
         header_size = i32(self.fp.read(4))
         version = i32(self.fp.read(4))
         if header_size < 20 or version != 1:
-            raise SyntaxError, "not a GIMP brush"
+            raise SyntaxError("not a GIMP brush")
 
         width = i32(self.fp.read(4))
         height = i32(self.fp.read(4))
         bytes = i32(self.fp.read(4))
         if width <= 0 or height <= 0 or bytes != 1:
-            raise SyntaxError, "not a GIMP brush"
+            raise SyntaxError("not a GIMP brush")
 
         comment = self.fp.read(header_size - 20)[:-1]
 

File PIL/GdImageFile.py

 #
 # The Python Imaging Library.
-# $Id: GdImageFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # GD file handling
 #

File PIL/GifImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: GifImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # GIF file handling
 #
         # Screen
         s = self.fp.read(13)
         if s[:6] not in ["GIF87a", "GIF89a"]:
-            raise SyntaxError, "not a GIF file"
+            raise SyntaxError("not a GIF file")
 
         self.info["version"] = s[:6]
 
             self.__fp.seek(self.__rewind)
 
         if frame != self.__frame + 1:
-            raise ValueError, "cannot seek to frame %d" % frame
+            raise ValueError("cannot seek to frame %d" % frame)
         self.__frame = frame
 
         self.tile = []
                     #
                     self.info["extension"] = block, self.fp.tell()
                     if block[:11] == "NETSCAPE2.0":
-                        self.info["loop"] = 1 # FIXME
+                        block = self.data()
+                        if len(block) >= 3 and ord(block[0]) == 1:
+                            self.info["loop"] = i16(block[1:3])
                 while self.data():
                     pass
 
 
             else:
                 pass
-                # raise IOError, "illegal GIF tag `%x`" % ord(s)
+                # raise IOError("illegal GIF tag `%x`" % ord(s))
 
         if not self.tile:
             # self.__fp = None
-            raise EOFError, "no more images in GIF file"
+            raise EOFError("no more images in GIF file")
 
         self.mode = "L"
         if self.palette:
        The first string is a local image header, the rest contains
        encoded image data."""
 
-    class collector:
+    class collector(object):
         data = []
         def write(self, data):
             self.data.append(data)

File PIL/GimpGradientFile.py

 #
 # Python Imaging Library
-# $Id: GimpGradientFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # stuff to read (and render) GIMP gradient files
 #
 #
 
 from math import pi, log, sin, sqrt
-import string
+
+import ImageString
 
 # --------------------------------------------------------------------
 # Stuff to translate curve segments to palette values (derived from
             # add to palette
             palette.append(r + g + b + a)
 
-        return string.join(palette, ""), "RGBA"
+        return ImageString.join(palette, ""), "RGBA"
 
 ##
 # File handler for GIMP's gradient format.
     def __init__(self, fp):
 
         if fp.readline()[:13] != "GIMP Gradient":
-            raise SyntaxError, "not a GIMP gradient file"
+            raise SyntaxError("not a GIMP gradient file")
 
         count = int(fp.readline())
 
 
         for i in range(count):
 
-            s = string.split(fp.readline())
+            s = ImageString.split(fp.readline())
             w = map(float, s[:11])
 
             x0, x1  = w[0], w[2]
             cspace  = int(s[12])
 
             if cspace != 0:
-                raise IOError, "cannot handle HSV colour space"
+                raise IOError("cannot handle HSV colour space")
 
             gradient.append((x0, x1, xm, rgb0, rgb1, segment))
 

File PIL/GimpPaletteFile.py

 #
 # Python Imaging Library
-# $Id: GimpPaletteFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # stuff to read GIMP palette files
 #
 # See the README file for information on usage and redistribution.
 #
 
-import re, string
+import re
+import ImageString
 
 ##
 # File handler for GIMP's palette format.
 
-class GimpPaletteFile:
+class GimpPaletteFile(object):
 
     rawmode = "RGB"
 
         self.palette = map(lambda i: chr(i)*3, range(256))
 
         if fp.readline()[:12] != "GIMP Palette":
-            raise SyntaxError, "not a GIMP palette file"
+            raise SyntaxError("not a GIMP palette file")
 
         i = 0
 
             if re.match("\w+:|#", s):
                 continue
             if len(s) > 100:
-                raise SyntaxError, "bad palette file"
+                raise SyntaxError("bad palette file")
 
-            v = tuple(map(int, string.split(s)[:3]))
+            v = tuple(map(int, ImageString.split(s)[:3]))
             if len(v) != 3:
-                raise ValueError, "bad palette entry"
+                raise ValueError("bad palette entry")
 
             if 0 <= i <= 255:
                 self.palette[i] = chr(v[0]) + chr(v[1]) + chr(v[2])
 
             i = i + 1
 
-        self.palette = string.join(self.palette, "")
+        self.palette = ImageString.join(self.palette, "")
 
 
     def getpalette(self):
-
         return self.palette, self.rawmode

File PIL/GribStubImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: GribStubImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # GRIB stub adapter
 #

File PIL/Hdf5StubImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: Hdf5StubImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # HDF5 stub adapter
 #

File PIL/IcnsImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: ImImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # Mac OS X icns file decoder, based on icns.py by Bob Ippolito.
 #
 #
 
 import Image, ImageFile
-import string, struct
+import ImageString
+import struct
 
 HEADERSIZE = 8
 
     fobj.seek(start)
     sig = fobj.read(4)
     if sig != '\x00\x00\x00\x00':
-        raise SyntaxError, 'Unknown signature, expecting 0x00000000'
+        raise SyntaxError('Unknown signature, expecting 0x00000000')
     return read_32(fobj, (start + 4, length - 4), (width, height))
 
 def read_32(fobj, (start, length), size):
                     "Error reading channel [%r left]" % bytesleft
                     )
             band = Image.frombuffer(
-                "L", size, string.join(data, ""), "raw", "L", 0, 1
+                "L", size, ImageString.join(data, ""), "raw", "L", 0, 1
                 )
             im.im.putband(band.im, band_ix)
     return {"RGB": im}
         self.fobj = fobj
         sig, filesize = nextheader(fobj)
         if sig != 'icns':
-            raise SyntaxError, 'not an icns file'
+            raise SyntaxError('not an icns file')
         i = HEADERSIZE
         while i < filesize:
             sig, blocksize = nextheader(fobj)
     def bestsize(self):
         sizes = self.itersizes()
         if not sizes:
-            raise SyntaxError, "No 32bit icon resources found"
+            raise SyntaxError("No 32bit icon resources found")
         return max(sizes)
 
     def dataforsize(self, size):

File PIL/IcoImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: IcoImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # Windows Icon support for PIL
 #
         # check magic
         s = self.fp.read(6)
         if not _accept(s):
-            raise SyntaxError, "not an ICO file"
+            raise SyntaxError("not an ICO file")
 
         # pick the largest icon in the file
         m = ""

File PIL/ImImagePlugin.py

 #
 # The Python Imaging Library.
-# $Id: ImImagePlugin.py 2285 2005-02-07 23:52:14Z fredrik $
+# $Id$
 #
 # IFUNC IM file handling for PIL
 #
         # 100 bytes, this is (probably) not a text header.
 
         if not "\n" in self.fp.read(100):
-            raise SyntaxError, "not an IM file"
+            raise SyntaxError("not an IM file")
         self.fp.seek(0)
 
         n = 0
 
             s = self.fp.read(1)
 
-            # Some versions of IFUNC uses \n\r instead of \r\n...
+            # Some versions of IFUNC use "\n\r" instead of "\r\n"
             if s == "\r":
                 continue
 
             if not s or s[0] == chr(0) or s[0] == chr(26):
                 break
 
-            # FIXME: this may read whole file if not a text file
-            s = s + self.fp.readline()
+            s = s + self.fp.safereadline(512)
 
             if len(s) > 100:
-                raise SyntaxError, "not an IM file"
+                raise SyntaxError("not an IM file")
 
             if s[-2:] == '\r\n':
                 s = s[:-2]
             try:
                 m = split.match(s)
             except re.error, v:
-                raise SyntaxError, "not an IM file"
+                raise SyntaxError("not an IM file")
 
             if m:
 
 
             else:
 
-                raise SyntaxError, "Syntax error in IM header: " + s
+                raise SyntaxError("Syntax error in IM header: " + s)
 
         if not n:
-            raise SyntaxError, "Not an IM file"
+            raise SyntaxError("Not an IM file")
 
         # Basic attributes
         self.size = self.info[SIZE]
         while s and s[0] != chr(26):
             s = self.fp.read(1)
         if not s:
-            raise SyntaxError, "File truncated"
+            raise SyntaxError("File truncated")
 
         if self.info.has_key(LUT):
             # convert lookup table to palette or lut attribute
     def seek(self, frame):
 
         if frame < 0 or frame >= self.info[FRAMES]:
-            raise EOFError, "seek outside sequence"
+            raise EOFError("seek outside sequence")
 
         if self.frame == frame:
             return
     try:
         type, rawmode = SAVE[im.mode]
     except KeyError:
-        raise ValueError, "Cannot save %s images as IM" % im.mode
+        raise ValueError("Cannot save %s images as IM" % im.mode)
 
     try:
         frames = im.encoderinfo["frames"]

File PIL/Image.py

 # 2003-05-10 fl   PIL release 1.1.4
 # 2005-03-28 fl   PIL release 1.1.5
 # 2006-12-02 fl   PIL release 1.1.6
-# 2009-03-XX fl   PIL release 1.1.7
+# 2009-11-15 fl   PIL release 1.1.7
 #
-# Copyright (c) 1997-2009 by Secret Labs AB.  All rights reserved.
-# Copyright (c) 1995-2009 by Fredrik Lundh.
+# Copyright (c) 1997-2010 by Secret Labs AB.  All rights reserved.
+# Copyright (c) 1995-2010 by Fredrik Lundh.
 #
 # See the README file for information on usage and redistribution.
 #
 
-VERSION = "1.1.7a0"
+__version__ = "1.1.7+"
+
+VERSION = __version__  # pre-1.1.8 compatibility
 
 try:
     import warnings
 
 import ImageMode
 import ImagePalette
+import ImageString
 
-import os, string, sys
+import ByteArray
+
+import os, sys
 
 # type stuff
 from types import IntType, StringType, TupleType
 def isDirectory(f):
     return isStringType(f) and os.path.isdir(f)
 
-from operator import isNumberType, isSequenceType
+from operator import isNumberType
+
+##
+# (Internal) Checks if an object is callable.
+
+def isCallable(f):
+    return callable(f)
 
 #
 # Debug level
 EXTENSION = {}
 
 # --------------------------------------------------------------------
+# Exceptions.  Note that for backwards compatibility, all custom
+# exceptions inherit from standard exceptions.
+
+# FIXME: add more exceptions here
+
+class VerificationError(SyntaxError):
+    pass
+
+# --------------------------------------------------------------------
 # Modes supported by this version
 
 _MODEINFO = {
 
 }
 
-if sys.byteorder == 'little':
+try:
+    byteorder = sys.byteorder
+except AttributeError:
+    import struct
+    if struct.unpack("h", "\0\1")[0] == 1:
+        byteorder = "big"
+    else:
+        byteorder = "little"
+
+if byteorder == 'little':
     _ENDIAN = '<'
 else:
     _ENDIAN = '>'
     "RGBX": ('|u1', 4),
     "RGBA": ('|u1', 4),
     "CMYK": ('|u1', 4),
-    "YCbCr": ('|u1', 4),
+    "YCbCr": ('|u1', 3),
 }
 
 def _conv_type_shape(im):
         # get decoder
         decoder = getattr(core, decoder_name + "_decoder")
         # print decoder, (mode,) + args + extra
-        return apply(decoder, (mode,) + args + extra)
+        return decoder(mode, *(args + extra))
     except AttributeError:
         raise IOError("decoder %s not available" % decoder_name)
 
         # get encoder
         encoder = getattr(core, encoder_name + "_encoder")
         # print encoder, (mode,) + args + extra
-        return apply(encoder, (mode,) + args + extra)
+        return encoder(mode, *(args + extra))
     except AttributeError:
         raise IOError("encoder %s not available" % encoder_name)
 
 # Simple expression analyzer
 
 class _E:
+    # FIXME: update to work with new-style classes
     def __init__(self, data): self.data = data
     def __coerce__(self, other): return self, _E(other)
     def __add__(self, other): return _E((self.data, "__add__", other.data))
         if s < 0:
             raise RuntimeError("encoder error %d in tostring" % s)
 
-        return string.join(data, "")
+        return ImageString.join(data, "")
 
     ##
     # Returns the image converted to an X11 bitmap.  This method
         if self.mode != "1":
             raise ValueError("not a bitmap")
         data = self.tostring("xbm")
-        return string.join(["#define %s_width %d\n" % (name, self.size[0]),
+        return ImageString.join(["#define %s_width %d\n" % (name, self.size[0]),
                 "#define %s_height %d\n"% (name, self.size[1]),
                 "static char %s_bits[] = {\n" % name, data, "};"], "")
 
 
         self.load()
 
-        if callable(filter):
+        if isCallable(filter):
             filter = filter()
         if not hasattr(filter, "filter"):
             raise TypeError("filter argument should be ImageFilter.Filter instance or class")
         return self.im.histogram()
 
     ##
-    # (Deprecated) Returns a copy of the image where the data has been
-    # offset by the given distances. Data wraps around the edges. If
-    # yoffset is omitted, it is assumed to be equal to xoffset.
-    # <p>
-    # This method is deprecated. New code should use the <b>offset</b>
-    # function in the <b>ImageChops</b> module.
-    #
-    # @param xoffset The horizontal distance.
-    # @param yoffset The vertical distance.  If omitted, both
-    #    distances are set to the same value.
-    # @return An Image object.
-
-    def offset(self, xoffset, yoffset=None):
-        "(deprecated) Offset image in horizontal and/or vertical direction"
-        if warnings:
-            warnings.warn(
-                "'offset' is deprecated; use 'ImageChops.offset' instead",
-                DeprecationWarning, stacklevel=2
-                )
-        import ImageChops
-        return ImageChops.offset(self, xoffset, yoffset)
-
-    ##
     # Pastes another image into this image. The box argument is either
     # a 2-tuple giving the upper left corner, a 4-tuple defining the
     # left, upper, right, and lower pixel coordinate, or None (same as
     #    image. A function can be used instead, it should take a single
     #    argument. The function is called once for each possible pixel
     #    value, and the resulting table is applied to all bands of the
-    #    image.
+    #    image.  For modes "I" and "F", the function must have the form
+    #    "x * scale + offset".
     # @param mode Output mode (default is same as input).  In the
     #    current version, this can only be used if the source image
     #    has mode "L" or "P", and the output has mode "1".
         if isinstance(lut, ImagePointHandler):
             return lut.point(self)
 
-        if not isSequenceType(lut):
+        if isCallable(lut):
             # if it isn't a list, it should be a function
             if self.mode in ("I", "I;16", "F"):
                 # check if the function can be used with point_transform
             palette = ImagePalette.raw(data.rawmode, data.palette)
         else:
             if not isStringType(data):
-                data = string.join(map(chr, data), "")
+                data = ImageString.join(map(chr, data), "")
             palette = ImagePalette.raw(rawmode, data)
         self.mode = "P"
         self.palette = palette
 
         preinit()
 
-        ext = string.lower(os.path.splitext(filename)[1])
+        ext = os.path.splitext(filename)[1]
+        ext = ext.lower()
 
         if not format:
             try:
                     raise KeyError(ext) # unknown extension
 
         try:
-            save_handler = SAVE[string.upper(format)]
+            save_handler = SAVE[format.upper()]
         except KeyError:
             init()
-            save_handler = SAVE[string.upper(format)] # unknown format
+            save_handler = SAVE[format.upper()] # unknown format
 
         if isStringType(fp):
             import __builtin__
     def split(self):
         "Split image into bands"
 
+        self.load()
         if self.im.bands == 1:
             ims = [self.copy()]
         else:
             ims = []
-            self.load()
             for i in range(self.im.bands):
                 ims.append(self._new(self.im.getband(i)))
         return tuple(ims)
 # --------------------------------------------------------------------
 # Abstract handlers.
 
-class ImagePointHandler:
+class ImagePointHandler(object):
     # used as a mixin by point transforms (for use with im.point)
     pass
 
-class ImageTransformHandler:
+class ImageTransformHandler(object):
     # used as a mixin by geometry transforms (for use with im.transform)
     pass
 
 # If obj is not contiguous, then the tostring method is called
 # and {@link frombuffer} is used.
 #
-# @param obj Object with array interface
-# @param mode Mode to use (will be determined from type if None)
+# @param obj Object with array interface.
+# @param mode Mode to use (will be determined from type if None).
 # @return An image memory.
 
 def fromarray(obj, mode=None):
             typekey = (1, 1) + shape[2:], arr['typestr']
             mode, rawmode = _fromarray_typemap[typekey]
         except KeyError:
-            # print typekey
             raise TypeError("Cannot handle this data type")
     else:
         rawmode = mode