convert.exe behaving diffrent between CMD and batch file !

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
fraizor
Posts: 10
Joined: 2015-06-18T16:33:21-07:00
Authentication code: 6789

convert.exe behaving diffrent between CMD and batch file !

Post by fraizor »

This is very strange issue
i have this image

Image

when using cmd and running this command

Code: Select all

convert 405_B.jpg -threshold 50% -bordercolor white -border 10 -fill black -draw "color 0,0 floodfill" -alpha off -shave 10x10 405_B_floodfill.gif
Image

when i put the exact same command in a .bat file and place the .bat file in the same directory that i used with cmd i get this:

Image

i cant understand why convert is behaving different when using cmd or bat !!
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: convert.exe behaving diffrent between CMD and batch file !

Post by dlemstra »

You should change -threshold to 50%% if you are inside a batch file (http://stackoverflow.com/questions/1450 ... a-cmd-file)
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
fraizor
Posts: 10
Joined: 2015-06-18T16:33:21-07:00
Authentication code: 6789

Re: convert.exe behaving diffrent between CMD and batch file !

Post by fraizor »

dlemstra

Thank you bro this is great, appreciate your help ..

that line was a part of my script, any other changes should be done when moving from cmd to catch other that replacing every % with %% for my commands:

Code: Select all

convert 405_B.jpg -threshold 50% -bordercolor white -border 10 -fill black -draw "color 0,0 floodfill" -alpha off -shave 10x10 405_B_floodfill.gif

Code: Select all

convert 405_B_floodfill.gif -define connected-components:verbose=true -connected-components 4 405_B_objects.png

Code: Select all

convert 405_B_objects.png -define connected-components:area-threshold=12119 -connected-components 4 -auto-level -morphology erode octagon:1 405_B_objects_ccl.png

Code: Select all

convert 405_B.jpg 405_B_objects_ccl.png -alpha off -compose copy_opacity -composite -trim +repage -background white -alpha background -alpha off 405_B_result.gif
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: convert.exe behaving diffrent between CMD and batch file !

Post by fmw42 »

I do not think so. But please review http://www.imagemagick.org/Usage/windows/#conversion
Post Reply