+ image magick tools to img.py

This commit is contained in:
tmshv committed 2016-01-16 23:07:42 +03:00
1 parent e2c0935e9b
commit 5b6b09b66b
1 file changed
+8 -1
+8 -1
View File
@@ -1,5 +1,7 @@
import os
from subprocess import call
__author__ = 'Roman Timashev'
from PIL import Image
@@ -22,4 +24,9 @@ def override_extension(dest, ext=None):
if ext is not None:
dest = os.path.splitext(dest)[0] + ext
return dest
return dest
def image_magick_resize(input_file, output_file, size, quality=85):
s = '%dx%d' % size
call(['convert', input_file, '-resize', s, '-quality', str(quality), output_file])