Created
September 6, 2012 18:55
-
-
Save agrif/3659457 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 2.7.2 (default, Apr 1 2012, 14:18:41) | |
[GCC 4.5.3] on linux2 | |
Type "help", "copyright", "credits" or "license" for more information. | |
>>> # load up a test file | |
>>> import OIL | |
>>> i = OIL.Image.load("input.png") | |
>>> i.get_size() | |
(800, 600) | |
>>> # save it to a stringio object | |
>>> import StringIO | |
>>> dest = StringIO.StringIO() | |
>>> i.save(dest) | |
>>> # see if it worked! | |
>>> len(dest.getvalue()) | |
718602 | |
>>> # load the stringio data into a new image | |
>>> dest.seek(0) | |
>>> newi = OIL.Image.load(dest) | |
>>> newi.get_size() | |
(800, 600) | |
>>> # !!! |
Author
agrif
commented
Sep 6, 2012
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment