







The PIL.ImageFile Module


_ParserFile(data) (class) [ #PIL.ImageFile._ParserFile-class# ]

(Internal) Support class for the Parser file.

For more information about this class, see #PIL.ImageFile._ParserFile-classThe _ParserFile Class .


_safe_read(fp, size)  [ #PIL.ImageFile._safe_read-function# ]

Reads large blocks in a safe way.  Unlike fp.read(n), this function
doesn't trust the user.  If the requested size is larger than
SAFEBLOCK, the file is read block by block.


fp

File handle.  Must implement a 
read method.

size

Number of bytes to read.

Returns:

A string containing up to 
size bytes of data.



_save(im, fp, tile)  [ #PIL.ImageFile._save-function# ]

(Helper) Save image body to file.


im

Image object.

fp

File object.

tile

Tile list.



ImageFile(fp=None, filename=None) (class) [ #PIL.ImageFile.ImageFile-class# ]

Base class for image file handlers.

For more information about this class, see #PIL.ImageFile.ImageFile-classThe ImageFile Class .


Parser (class)  [ #PIL.ImageFile.Parser-class# ]

Incremental image parser.

For more information about this class, see #PIL.ImageFile.Parser-classThe Parser Class .


StubImageFile (class)  [ #PIL.ImageFile.StubImageFile-class# ]

Base class for stub image loaders.

For more information about this class, see #PIL.ImageFile.StubImageFile-classThe StubImageFile Class .



The _ParserFile Class 


_ParserFile(data) (class) [ #PIL.ImageFile._ParserFile-class# ]

(Internal) Support class for the Parser file.


The ImageFile Class 


ImageFile(fp=None, filename=None) (class) [ #PIL.ImageFile.ImageFile-class# ]

Base class for image file handlers.



The Parser Class 


Parser (class)  [ #PIL.ImageFile.Parser-class# ]

Incremental image parser.  This class implements the standard
feed/close consumer interface.


close()  [ #PIL.ImageFile.Parser.close-method# ]

(Consumer) Close the stream.


Returns:

An image object.

Raises IOError:
If the parser failed to parse the image file.



feed(data)  [ #PIL.ImageFile.Parser.feed-method# ]

(Consumer) Feed data to the parser.


data

A string buffer.

Raises IOError:
If the parser failed to parse the image file.



reset()  [ #PIL.ImageFile.Parser.reset-method# ]

(Consumer) Reset the parser.  Note that you can only call this
method immediately after you've created a parser; parser
instances cannot be reused.



The StubImageFile Class 


StubImageFile (class)  [ #PIL.ImageFile.StubImageFile-class# ]

Base class for stub image loaders.

A stub loader is an image loader that can identify files of a
certain format, but relies on external code to load the file.

_load()  [ #PIL.ImageFile.StubImageFile._load-method# ]

(Hook) Find actual image loader.




