Skip to content

Instantly share code, notes, and snippets.

@khajer
Last active December 20, 2015 10:20
Show Gist options
  • Select an option

  • Save khajer/6115271 to your computer and use it in GitHub Desktop.

Select an option

Save khajer/6115271 to your computer and use it in GitHub Desktop.
resize (*2) all image path for -hd. powered by python and pil
import Image
import os
listfile = os.listdir(os.getcwd())
scale = 2
for f in listfile:
if f.split('.')[1] == 'png':
print f
im = Image.open(f)
w = im.size[0]*scale
h = im.size[1]*scale
nIm = im.resize((w, h), Image.ANTIALIAS)
nIm.save(f.split('.')[0]+'-hd'+'.png')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment