From 5b6b09b66b2751794b05a1bc46054bdc4b85f070 Mon Sep 17 00:00:00 2001 From: Roman Timashev Date: Sat, 16 Jan 2016 23:07:42 +0300 Subject: [PATCH] + image magick tools to img.py --- utils/Sync/img.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/utils/Sync/img.py b/utils/Sync/img.py index e4a1fb9d..0ea192f4 100644 --- a/utils/Sync/img.py +++ b/utils/Sync/img.py @@ -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 \ No newline at end of file + 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])