Skip to content

Instantly share code, notes, and snippets.

@hhatto
Created March 26, 2011 17:07
Show Gist options
  • Save hhatto/888447 to your computer and use it in GitHub Desktop.
Save hhatto/888447 to your computer and use it in GitHub Desktop.
fast scale with pgmagick (jpeg only)
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