home *** CD-ROM | disk | FTP | other *** search
/ OS/2 Shareware BBS: 10 Tools / 10-Tools.zip / pypil112.zip / PIL-1.1.2.zip / Lib / site-packages / PIL / ImageFileIO.py < prev    next >
Text File  |  2001-05-03  |  595b  |  29 lines

  1. #
  2. # The Python Imaging Library.
  3. # $Id$
  4. #
  5. # kludge to get basic ImageFileIO functionality
  6. #
  7. # History:
  8. # 98-08-06 fl   Recreated
  9. #
  10. # Copyright (c) Secret Labs AB 1998.
  11. #
  12. # See the README file for information on usage and redistribution.
  13. #
  14.  
  15. from StringIO import StringIO
  16.  
  17. class ImageFileIO(StringIO):
  18.     def __init__(self, fp):
  19.         data = fp.read()
  20.         StringIO.__init__(self, data)
  21.  
  22. if __name__ == "__main__":
  23.  
  24.     import Image
  25.     fp = open("/images/clenna.im", "rb")
  26.     im = Image.open(ImageFileIO(fp))
  27.     im.load() # make sure we can read the raster data
  28.     print im.mode, im.size
  29.