home *** CD-ROM | disk | FTP | other *** search
/ Enter 2004 April / enter-2004-04.iso / files / EVE_1424_100181.exe / ImageFileIO.py < prev    next >
Encoding:
Python Source  |  2004-04-20  |  691 b   |  31 lines

  1. #
  2. # The Python Imaging Library.
  3. # $Id: //modules/pil/PIL/ImageFileIO.py#2 $
  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. # this module is deprecated
  18.  
  19. class ImageFileIO(StringIO):
  20.     def __init__(self, fp):
  21.         data = fp.read()
  22.         StringIO.__init__(self, data)
  23.  
  24. if __name__ == "__main__":
  25.  
  26.     import Image
  27.     fp = open("/images/clenna.im", "rb")
  28.     im = Image.open(ImageFileIO(fp))
  29.     im.load() # make sure we can read the raster data
  30.     print im.mode, im.size
  31.