Commits

Fredrik Lundh committed 2f5c9bf Merge

Merged in trunk.

Comments (0)

Files changed (252)

 syntax: glob
 *~
+*.bat
 *.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.pth
 Imaging/PIL/__init__.py
-Imaging/PIL/ArgImagePlugin.py
 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/PIL/MpegImagePlugin.py
 Imaging/PIL/MspImagePlugin.py
 Imaging/PIL/OleFileIO.py
+Imaging/PIL/OpenExrImagePlugin.py
 Imaging/PIL/PaletteFile.py
 Imaging/PIL/PalmImagePlugin.py
 Imaging/PIL/PcdImagePlugin.py
 
 Imaging/Docs/index.html
 Imaging/Docs/effbot.css
-Imaging/Docs/pythondoc-PIL.ArgImagePlugin.html
 Imaging/Docs/pythondoc-PIL.BdfFontFile.html
 Imaging/Docs/pythondoc-PIL.BmpImagePlugin.html
 Imaging/Docs/pythondoc-PIL.BufrStubImagePlugin.html
 Imaging/Scripts/pilprint.py
 
 Imaging/Images/lena.gif
+Imaging/Images/lena.png
 Imaging/Images/lena.ppm
 Imaging/Images/lena.jpg
 
 <dt><a href='pythondoc-PIL.ImageTransform.html'>The PIL.ImageTransform Module</a></dt>
 <dt><a href='pythondoc-PIL.ImageWin.html'>The PIL.ImageWin Module</a></dt>
 <dt>&nbsp;</dt>
-<dt><a href='pythondoc-PIL.ArgImagePlugin.html'>The PIL.ArgImagePlugin Module</a></dt>
 <dt><a href='pythondoc-PIL.BdfFontFile.html'>The PIL.BdfFontFile Module</a></dt>
 <dt><a href='pythondoc-PIL.BmpImagePlugin.html'>The PIL.BmpImagePlugin Module</a></dt>
 <dt><a href='pythondoc-PIL.BufrStubImagePlugin.html'>The PIL.BufrStubImagePlugin Module</a></dt>

Docs/pythondoc-PIL.ArgImagePlugin.html

-<!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Strict//EN' 'http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd'>
-<html>
-<head>
-<meta http-equiv='Content-Type' content='text/html; charset=us-ascii' />
-<title>The PIL.ArgImagePlugin Module</title>
-<link rel='stylesheet' href='effbot.css' type='text/css' />
-</head>
-<body>
-<h1>The PIL.ArgImagePlugin Module</h1>
-<dl>
-<dt><b>ArgImageFile</b> (class)  [<a href='#PIL.ArgImagePlugin.ArgImageFile-class'>#</a>]</dt>
-<dd>
-<p>Image plugin for the experimental Animated Raster Graphics format.</p>
-<p>For more information about this class, see <a href='#PIL.ArgImagePlugin.ArgImageFile-class'><i>The ArgImageFile Class</i></a>.</p>
-</dd>
-</dl>
-<h2><a id='PIL.ArgImagePlugin.ArgImageFile-class' name='PIL.ArgImagePlugin.ArgImageFile-class'>The ArgImageFile Class</a></h2>
-<dl>
-<dt><b>ArgImageFile</b> (class)  [<a href='#PIL.ArgImagePlugin.ArgImageFile-class'>#</a>]</dt>
-<dd>
-</dd>
-</dl>
-</body></html>

Images/lena.png

Old
Old image
New
New image

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

PIL/ArgImagePlugin.py

-#
-# THIS IS WORK IN PROGRESS
-#
-# The Python Imaging Library.
-# $Id: ArgImagePlugin.py 2309 2005-03-02 15:06:34Z fredrik $
-#
-# ARG animation support code
-#
-# history:
-# 1996-12-30 fl   Created
-# 1996-01-06 fl   Added safe scripting environment
-# 1996-01-10 fl   Added JHDR, UHDR and sYNC support
-# 2005-03-02 fl   Removed AAPP and ARUN support
-#
-# Copyright (c) Secret Labs AB 1997.
-# Copyright (c) Fredrik Lundh 1996-97.
-#
-# See the README file for information on usage and redistribution.
-#
-
-__version__ = "0.4"
-
-import Image, ImageFile, ImagePalette
-
-from PngImagePlugin import i16, i32, ChunkStream, _MODES
-
-MAGIC = "\212ARG\r\n\032\n"
-
-# --------------------------------------------------------------------
-# ARG parser
-
-class ArgStream(ChunkStream):
-    "Parser callbacks for ARG data"
-
-    def __init__(self, fp):
-
-        ChunkStream.__init__(self, fp)
-
-        self.eof = 0
-
-        self.im = None
-        self.palette = None
-
-        self.__reset()
-
-    def __reset(self):
-
-        # reset decoder state (called on init and sync)
-
-        self.count = 0
-        self.id = None
-        self.action = ("NONE",)
-
-        self.images = {}
-        self.names = {}
-
-
-    def chunk_AHDR(self, offset, bytes):
-        "AHDR -- animation header"
-
-        # assertions
-        if self.count != 0:
-            raise SyntaxError, "misplaced AHDR chunk"
-
-        s = self.fp.read(bytes)
-        self.size = i32(s), i32(s[4:])
-        try:
-            self.mode, self.rawmode = _MODES[(ord(s[8]), ord(s[9]))]
-        except:
-            raise SyntaxError, "unknown ARG mode"
-
-        if Image.DEBUG:
-            print "AHDR size", self.size
-            print "AHDR mode", self.mode, self.rawmode
-
-        return s
-
-    def chunk_AFRM(self, offset, bytes):
-        "AFRM -- next frame follows"
-
-        # assertions
-        if self.count != 0:
-            raise SyntaxError, "misplaced AFRM chunk"
-
-        self.show = 1
-        self.id = 0
-        self.count = 1
-        self.repair = None
-
-        s = self.fp.read(bytes)
-        if len(s) >= 2:
-            self.id = i16(s)
-            if len(s) >= 4:
-                self.count = i16(s[2:4])
-                if len(s) >= 6:
-                    self.repair = i16(s[4:6])
-                else:
-                    self.repair = None
-
-        if Image.DEBUG:
-            print "AFRM", self.id, self.count
-
-        return s
-
-    def chunk_ADEF(self, offset, bytes):
-        "ADEF -- store image"
-
-        # assertions
-        if self.count != 0:
-            raise SyntaxError, "misplaced ADEF chunk"
-
-        self.show = 0
-        self.id = 0
-        self.count = 1
-        self.repair = None
-
-        s = self.fp.read(bytes)
-        if len(s) >= 2:
-            self.id = i16(s)
-            if len(s) >= 4:
-                self.count = i16(s[2:4])
-
-        if Image.DEBUG:
-            print "ADEF", self.id, self.count
-
-        return s
-
-    def chunk_NAME(self, offset, bytes):
-        "NAME -- name the current image"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced NAME chunk"
-
-        name = self.fp.read(bytes)
-        self.names[self.id] = name
-
-        return name
-
-    def chunk_AEND(self, offset, bytes):
-        "AEND -- end of animation"
-
-        if Image.DEBUG:
-            print "AEND"
-
-        self.eof = 1
-
-        raise EOFError, "end of ARG file"
-
-    def __getmodesize(self, s, full=1):
-
-        size = i32(s), i32(s[4:])
-
-        try:
-            mode, rawmode = _MODES[(ord(s[8]), ord(s[9]))]
-        except:
-            raise SyntaxError, "unknown image mode"
-
-        if full:
-            if ord(s[12]):
-                pass # interlace not yet supported
-            if ord(s[11]):
-                raise SyntaxError, "unknown filter category"
-
-        return size, mode, rawmode
-
-    def chunk_PAST(self, offset, bytes):
-        "PAST -- paste one image into another"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced PAST chunk"
-
-        if self.repair is not None:
-            # we must repair the target image before we
-            # start pasting
-
-            # brute force; a better solution would be to
-            # update only the dirty rectangles in images[id].
-            # note that if images[id] doesn't exist, it must
-            # be created
-
-            self.images[self.id] = self.images[self.repair].copy()
-            self.repair = None
-
-        s = self.fp.read(bytes)
-        im = self.images[i16(s)]
-        x, y = i32(s[2:6]), i32(s[6:10])
-        bbox = x, y, im.size[0]+x, im.size[1]+y
-
-        if im.mode in ["RGBA"]:
-            # paste with transparency
-            # FIXME: should handle P+transparency as well
-            self.images[self.id].paste(im, bbox, im)
-        else:
-            # paste without transparency
-            self.images[self.id].paste(im, bbox)
-
-        self.action = ("PAST",)
-        self.__store()
-
-        return s
-
-    def chunk_BLNK(self, offset, bytes):
-        "BLNK -- create blank image"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced BLNK chunk"
-
-        s = self.fp.read(bytes)
-        size, mode, rawmode = self.__getmodesize(s, 0)
-
-        # store image (FIXME: handle colour)
-        self.action = ("BLNK",)
-        self.im = Image.core.fill(mode, size, 0)
-        self.__store()
-
-        return s
-
-    def chunk_IHDR(self, offset, bytes):
-        "IHDR -- full image follows"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced IHDR chunk"
-
-        # image header
-        s = self.fp.read(bytes)
-        size, mode, rawmode = self.__getmodesize(s)
-
-        # decode and store image
-        self.action = ("IHDR",)
-        self.im = Image.core.new(mode, size)
-        self.decoder = Image.core.zip_decoder(rawmode)
-        self.decoder.setimage(self.im, (0,0) + size)
-        self.data = ""
-
-        return s
-
-    def chunk_DHDR(self, offset, bytes):
-        "DHDR -- delta image follows"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced DHDR chunk"
-
-        s = self.fp.read(bytes)
-
-        size, mode, rawmode = self.__getmodesize(s)
-
-        # delta header
-        diff = ord(s[13])
-        offs = i32(s[14:18]), i32(s[18:22])
-
-        bbox = offs + (offs[0]+size[0], offs[1]+size[1])
-
-        if Image.DEBUG:
-            print "DHDR", diff, bbox
-
-        # FIXME: decode and apply image
-        self.action = ("DHDR", diff, bbox)
-
-        # setup decoder
-        self.im = Image.core.new(mode, size)
-
-        self.decoder = Image.core.zip_decoder(rawmode)
-        self.decoder.setimage(self.im, (0,0) + size)
-
-        self.data = ""
-
-        return s
-
-    def chunk_JHDR(self, offset, bytes):
-        "JHDR -- JPEG image follows"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced JHDR chunk"
-
-        # image header
-        s = self.fp.read(bytes)
-        size, mode, rawmode = self.__getmodesize(s, 0)
-
-        # decode and store image
-        self.action = ("JHDR",)
-        self.im = Image.core.new(mode, size)
-        self.decoder = Image.core.jpeg_decoder(rawmode)
-        self.decoder.setimage(self.im, (0,0) + size)
-        self.data = ""
-
-        return s
-
-    def chunk_UHDR(self, offset, bytes):
-        "UHDR -- uncompressed image data follows (EXPERIMENTAL)"
-
-        # assertions
-        if self.count == 0:
-            raise SyntaxError, "misplaced UHDR chunk"
-
-        # image header
-        s = self.fp.read(bytes)
-        size, mode, rawmode = self.__getmodesize(s, 0)
-
-        # decode and store image
-        self.action = ("UHDR",)
-        self.im = Image.core.new(mode, size)
-        self.decoder = Image.core.raw_decoder(rawmode)
-        self.decoder.setimage(self.im, (0,0) + size)
-        self.data = ""
-
-        return s
-
-    def chunk_IDAT(self, offset, bytes):
-        "IDAT -- image data block"
-
-        # pass compressed chunks through the decoder
-        s = self.fp.read(bytes)
-        self.data = self.data + s
-        n, e = self.decoder.decode(self.data)
-        if n < 0:
-            # end of image
-            if e < 0:
-                raise IOError, "decoder error %d" % e
-        else:
-            self.data = self.data[n:]
-
-        return s
-
-    def chunk_DEND(self, offset, bytes):
-        return self.chunk_IEND(offset, bytes)
-
-    def chunk_JEND(self, offset, bytes):
-        return self.chunk_IEND(offset, bytes)
-
-    def chunk_UEND(self, offset, bytes):
-        return self.chunk_IEND(offset, bytes)
-
-    def chunk_IEND(self, offset, bytes):
-        "IEND -- end of image"
-
-        # we now have a new image.  carry out the operation
-        # defined by the image header.
-
-        # won't need these anymore
-        del self.decoder
-        del self.data
-
-        self.__store()
-
-        return self.fp.read(bytes)
-
-    def __store(self):
-
-        # apply operation
-        cid = self.action[0]
-
-        if cid in ["BLNK", "IHDR", "JHDR", "UHDR"]:
-            # store
-            self.images[self.id] = self.im
-
-        elif cid == "DHDR":
-            # paste
-            cid, mode, bbox = self.action
-            im0 = self.images[self.id]
-            im1 = self.im
-            if mode == 0:
-                im1 = im1.chop_add_modulo(im0.crop(bbox))
-            im0.paste(im1, bbox)
-
-        self.count = self.count - 1
-
-        if self.count == 0 and self.show:
-            self.im = self.images[self.id]
-            raise EOFError # end of this frame
-
-    def chunk_PLTE(self, offset, bytes):
-        "PLTE -- palette data"
-
-        s = self.fp.read(bytes)
-        if self.mode == "P":
-            self.palette = ImagePalette.raw("RGB", s)
-        return s
-
-    def chunk_sYNC(self, offset, bytes):
-        "SYNC -- reset decoder"
-
-        if self.count != 0:
-            raise SyntaxError, "misplaced sYNC chunk"
-
-        s = self.fp.read(bytes)
-        self.__reset()
-        return s
-
-
-# --------------------------------------------------------------------
-# ARG reader
-
-def _accept(prefix):
-    return prefix[:8] == MAGIC
-
-##
-# Image plugin for the experimental Animated Raster Graphics format.
-
-class ArgImageFile(ImageFile.ImageFile):
-
-    format = "ARG"
-    format_description = "Animated raster graphics"
-
-    def _open(self):
-
-        if Image.warnings:
-            Image.warnings.warn(
-                "The ArgImagePlugin driver is obsolete, and will be removed "
-                "from a future release of PIL.  If you rely on this module, "
-                "please contact the PIL authors.",
-                RuntimeWarning
-                )
-
-        if self.fp.read(8) != MAGIC:
-            raise SyntaxError, "not an ARG file"
-
-        self.arg = ArgStream(self.fp)
-
-        # read and process the first chunk (AHDR)
-
-        cid, offset, bytes = self.arg.read()
-
-        if cid != "AHDR":
-            raise SyntaxError, "expected an AHDR chunk"
-
-        s = self.arg.call(cid, offset, bytes)
-
-        self.arg.crc(cid, s)
-
-        # image characteristics
-        self.mode = self.arg.mode
-        self.size = self.arg.size
-
-    def load(self):
-
-        if self.arg.im is None:
-            self.seek(0)
-
-        # image data
-        self.im = self.arg.im
-        self.palette = self.arg.palette
-
-        # set things up for further processing
-        Image.Image.load(self)
-
-    def seek(self, frame):
-
-        if self.arg.eof:
-            raise EOFError, "end of animation"
-
-        self.fp = self.arg.fp
-
-        while 1:
-
-            #
-            # process chunks
-
-            cid, offset, bytes = self.arg.read()
-
-            if self.arg.eof:
-                raise EOFError, "end of animation"
-
-            try:
-                s = self.arg.call(cid, offset, bytes)
-            except EOFError:
-                break
-
-            except "glurk": # AttributeError
-                if Image.DEBUG:
-                    print cid, bytes, "(unknown)"
-                s = self.fp.read(bytes)
-
-            self.arg.crc(cid, s)
-
-        self.fp.read(4) # ship extra CRC
-
-    def tell(self):
-        return 0
-
-    def verify(self):
-        "Verify ARG file"
-
-        # back up to first chunk
-        self.fp.seek(8)
-
-        self.arg.verify(self)
-        self.arg.close()
-
-        self.fp = None
-
-#
-# --------------------------------------------------------------------
-
-Image.register_open("ARG", ArgImageFile, _accept)
-
-Image.register_extension("ARG", ".arg")
-
-Image.register_mime("ARG", "video/x-arg")
 #
 # 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:

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:

PIL/BufrStubImagePlugin.py

 #
 # The Python Imaging Library
-# $Id: BufrStubImagePlugin.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # BUFR stub adapter
 #
+#
+# The Python Imaging Library.
+# $Id$
+#
+# simple <byte array type
+#
+# history:
+# 2011-01-05 fl   Created
+#
+# Copyright (c) 2011 by Secret Labs AB
+# Copyright (c) 2011 by Fredrik Lundh
+#
+# See the README file for information on usage and redistribution.
+#
+
+import struct
+
+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
+
+    def unpack(self, fmt, i=0):
+        try:
+            n = struct.calcsize(fmt)
+            v = struct.unpack(fmt, self.data[i:i+n])
+        except struct.error, v:
+            raise ValueError(v)
+        if len(v) == 1:
+            v = v[0] # singleton
+        return v
 #
 # 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.

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 = ""

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 = []

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:
     return im
 
 
-class PSFile:
+class PSFile(object):
     """Wrapper that treats either CR or LF as end of line."""
     def __init__(self, fp):
         self.fp = fp
             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:
         #
 #
 # The Python Imaging Library.
-# $Id: ExifTags.py 2631 2006-02-12 23:41:52Z fredrik $
+# $Id$
 #
 # EXIF tags
 #

PIL/FitsStubImagePlugin.py

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

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
 #
 # 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
 

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:

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]
 
 #
 # The Python Imaging Library.
-# $Id: GdImageFile.py 2134 2004-10-06 08:55:20Z fredrik $
+# $Id$
 #
 # GD file handling
 #

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)

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