Created
March 26, 2011 17:07
-
-
Save hhatto/888447 to your computer and use it in GitHub Desktop.
fast scale with pgmagick (jpeg only)
This file contains 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
import pgmagick | |
import time | |
# fast read | |
b = time.time() | |
img = pgmagick.Image(pgmagick.Blob(open('org.jpg').read()), pgmagick.Geometry(180, 120)) | |
img.scale('180x120') | |
img.write('t.jpg') | |
print time.time() - b | |
# slow read | |
b = time.time() | |
img = pgmagick.Image('org.jpg') | |
img.scale('180x120') | |
img.write('t.jpg') | |
print time.time() - b |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment