contradicting resize using Windows/Linux/python/console
Posted: 2016-08-30T04:19:05-07:00
Hi,
using same call for modifier -resize und Windows and Linux convert results in different sizes.
Windows version: ImageMagick 6.9.0-0
Linux version: ImageMagick 6.8.9-9
in.jpg = https://postimg.org/image/r6z743nub/
convert call:
Both calls create images of size 512x177
Now I use the following python script convert.py to call the commands:
calling python (version 3.5) via
I get different sizes:
so this is called from python under windows but it results in 1484x512.
What is the mistake? I cannot fetch it.
using same call for modifier -resize und Windows and Linux convert results in different sizes.
Windows version: ImageMagick 6.9.0-0
Linux version: ImageMagick 6.8.9-9
in.jpg = https://postimg.org/image/r6z743nub/
convert call:
Code: Select all
convert -trim -resize 512x512^> in.jpg out.jpg # Windows
convert -trim -resize 512x512\> in.jpg out.jpg # Linux
Now I use the following python script convert.py to call the commands:
Code: Select all
import os, subprocess, sys
def mycall(call_list):
if os.name == 'posix':
print(' '.join(call_list), '###')
subprocess.call(call_list)
elif os.name == 'nt':
if call_list[0] == 'convert':
call_list[0] = os.path.normpath('C:\\Program Files\\ImageMagick-6.9.0-Q16\\convert.exe')
assert os.path.isfile(call_list[0])
print(' '.join(call_list), '###')
subprocess.call(call_list, shell=False)
else:
assert False
def _escape(text):
if os.name == 'posix':
return text.replace('>', r'\>')
if os.name == 'nt':
return text.replace('>', '^>')
else:
assert False
src = sys.argv[1]
trg = sys.argv[2]
call_list = ['convert', '-trim', '-resize', _escape('512x512>'), src, trg]
mycall(call_list)
Code: Select all
python convert.py in.jpg out.jpg
- under Linux 512x177 and
- under Windows 1484x512.
Code: Select all
C:\Program Files\ImageMagick-6.9.0-Q16\convert.exe -trim -resize 512x512^> in.jpg out.jpg ###
What is the mistake? I cannot fetch it.