Writing your own image plugin
Pillow uses a plugin model which allows you to add your own
decoders and encoders to the library, without any changes to the library
itself. Such plugins usually have names like XxxImagePlugin.py,
where Xxx is a unique format name (usually an abbreviation).
Pillow decodes files in two stages:
It loops over the available image plugins in the loaded order, and calls the plugin’s
_acceptfunction with the first 16 bytes of the file. If the_acceptfunction returns true, the plugin’smethod is called to set up the image metadata and image tiles. The method is not for decoding the actual image data.