bookmark

D. Writing Your Own File Decoder


Description

The Python Imaging Library uses a plug-in model which allows you to add your own decoders to the library, without any changes to the library itself. Such plug-ins have names like XxxImagePlugin.py, where Xxx is a unique format name (usually an abbreviation). A decoder plug-in should contain a decoder class, based on the ImageFile base class defined in the module with the same name. This class should provide an _open method, which reads the file header and sets up at least the mode and size attributes. To be able to load the file, the method must also create a list of tile descriptors. The class must be explicitly registered, via a call to the Image module.

Preview

Tags

Users

  • @carlfischer

Comments and Reviews