On Thursday 13 December 2007 22:47, Xiao wrote: > Hi, is it possible to read only a part of an image (png or gif) by > PIL? > > For example, an image is 20000x20000 in pixels. Is it possible for > python to read only 100x100 of the picture (not loading the whole > picture) and save the small part to a new png file? > > Any ideas would be appreciated. Thanks.
Not with PIL straight. It could be done interfacing straight with libpng - you can check the PIL source code to check how PNG's are loaded and work your own implementation from there. Maybe it is evne possible to make "low level" calls to the classes and methods defined in PIL/PngImagePlugin.py (in the source tree) - if not, you certainly can just override some classes from that file and work your implementation. js -><_ _______________________________________________ Image-SIG maillist - Image-SIG@python.org http://mail.python.org/mailman/listinfo/image-sig