Created
April 29, 2014 21:25
-
-
Save xtornasol512/a4a17bc16a01e12ab417 to your computer and use it in GitHub Desktop.
Wand, Python, resize 1920 and quality 92 or more
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
# -*- coding: utf-8 -*- | |
""" | |
Author: Jesus A. Garzon | |
github: xtornasol512 | |
twitter: xtornasol512 | |
Description: | |
Just put this script in your directory of images | |
After create a directory for img_result | |
Then execute the script | |
python resize1920.py | |
Enjoy having more time to do another things :P | |
""" | |
import os | |
from wand.image import Image | |
#List of Files or Current Directory | |
files = os.listdir(os.curdir) | |
#Remove script and the directory of result | |
files.remove('resize1920.py') | |
files.remove('imgNew') | |
#We can order or not just like you prefer :D | |
files = sorted(files) | |
for f in files: | |
image = Image(filename=f) | |
with image.clone() as img: | |
img.transform(resize='1920') | |
img.compression_quality= 93 | |
img.save(filename='imgNew/1920x_' + f) | |
print f | |
print 'nuevo tamaño: ', img.size |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment