i have around 7 IM commands to be executed one after the other. i have written them in .bat file and started executing them in the command prompt. there all commands were executing but they are not working. but the result makes no difference before and after the execution.
Should I need to make changes in the file
my file looks like this:
convert 27.jpg -resize 240x320 27.png
convert 27.png -fuzz 50% -fill white -opaque white 27_f.png
convert 27_f.png -transparent white 27_tr.png
convert 27_tr.png -alpha extract -edge 2 27_alpha.png
convert 27_alpha.png 27_alpha.txt
what do i need to inlcude??
executing the imagemagick commands in batch file
-
- Posts: 1015
- Joined: 2005-03-21T21:16:57-07:00
Re: executing the imagemagick commands in batch file
Windows also has its own convert command and your batch script may be executing that instead of the ImageMagick version.
Try copying the Imagemagick convert.exe to imconvert.exe and then change your batch script to use imconvert instead of convert.
Pete
Try copying the Imagemagick convert.exe to imconvert.exe and then change your batch script to use imconvert instead of convert.
Pete
Sorry, my ISP shutdown all personal webspace so my MagickWand Examples in C is offline.
See my message in this topic for a link to a zip of all the files.
See my message in this topic for a link to a zip of all the files.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: executing the imagemagick commands in batch file
Also double the '%'
Other than that you can concatenate the options..
The operation sequence is a little strange what is wrong with...
+opaque white means anything not within 50% (current fuzz setting) white!
Other than that you can concatenate the options..
Code: Select all
convert 27.jpg -resize 240x320^
-fuzz 50%% -fill white -opaque white ^
-fuzz 0 -transparent white ^
-alpha extract -edge 2 ^
27_alpha.txt
Code: Select all
... -fuzz 50%% -fill white -opaque white -fill black +opaque white ...
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
Re: executing the imagemagick commands in batch file
Thanq.anthony wrote:Also double the '%'
Other than that you can concatenate the options..The operation sequence is a little strange what is wrong with...Code: Select all
convert 27.jpg -resize 240x320^ -fuzz 50%% -fill white -opaque white ^ -fuzz 0 -transparent white ^ -alpha extract -edge 2 ^ 27_alpha.txt
+opaque white means anything not within 50% (current fuzz setting) white!Code: Select all
... -fuzz 50%% -fill white -opaque white -fill black +opaque white ...
But can I write the code in such a way that the while executing it must ask for the "input file name".
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: executing the imagemagick commands in batch file
No. IM has no method of prompting or reading input like that. That is something that the wrapper program (DOS, Shell, PHP, etc) would need to do.sin wrote:But can I write the code in such a way that the while executing it must ask for the "input file name".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: executing the imagemagick commands in batch file
I can't see what's wrong with your batch file, aside from the two percent signs (50%%) as Anthony said already.
At http://www.imagemagick.org/Usage/windows/#debugging I give a few hints on debugging batch files. As a start, I would recommend starting it within a DOS box, such that you have some feedback on what's really happening.
You can than write a protocol of what's really happening by redirecting the batch file's output to a logfile. Convert writes part of its messages to stderr instead of stdout, such that you have to redirect both stdout and stderr to the logfile. Assuming that your batch is named 'mybatch.bat', you should run a command like
which redirects both, stdout and stderr, to the file 'output.log'.
At http://www.imagemagick.org/Usage/windows/#debugging I give a few hints on debugging batch files. As a start, I would recommend starting it within a DOS box, such that you have some feedback on what's really happening.
You can than write a protocol of what's really happening by redirecting the batch file's output to a logfile. Convert writes part of its messages to stderr instead of stdout, such that you have to redirect both stdout and stderr to the logfile. Assuming that your batch is named 'mybatch.bat', you should run a command like
Code: Select all
mybatch>>output.log 2>&1
Wolfgang Hugemann