[Tutor] command call in Windows for Image converting with
ImageMagick
Michael Lange
klappnase at freenet.de
Thu Apr 15 08:17:44 EDT 2004
On Tue, 06 Apr 2004 13:12:00 +0200
Michael Just <mjust at sun11.ukl.uni-freiburg.de> wrote:
> Here are my questions:
>
> 1) How can I start the program "identify <image-file-name>"?
> I got the <image-file-name> already with "os.listdir(os.curdir)"
>
> 2) How I fetch the output of "identify <image-file-name>"?
>
import commands
image_data = commands.getoutput("identify <image-file-name>")
> The call for "convert" will be the same as for 1) and 2).
>
> 3) How about error-handling, when a file could not be resized?
import os
exit_state = os.system("convert <etc.>")
if exit_state == 0:
<success>...
else:
<failure>...
I must admit that I'm not really sure if this works on windows, with linux I think this
should do what you want.
I hope this helps
Michael
More information about the Tutor
mailing list