Reputation: 17881
Command:
root@host:~#convert source.jpg -resize x500 -resize "500x<" -gravity center +repage target.jpg
Python code:
>> command_list = ['convert', 'source.jpg', '-resize', 'x500', '-resize', '\'500x<\'', '-gravity', 'center', 'target.jpg']
>> p = subprocess.call(command_list)
convert: invalid argument for option `'500x<'': -resize.
What's wrong in above code?
Upvotes: 2
Views: 3244
Reputation: 137312
Why the extra quotes on 500x<
? Subprocess will correctly quote any arguments.
Keep in mind that the shell will NOT pass the outer quotes to the application, just the quoted value, but subprocess will pass the quotes if you force it to.
Upvotes: 5