Page 1 of 1

convert.exe behaving diffrent between CMD and batch file !

Posted: 2015-06-21T04:48:20-07:00
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 !!

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

Posted: 2015-06-21T04:54:55-07:00
by dlemstra
You should change -threshold to 50%% if you are inside a batch file (http://stackoverflow.com/questions/1450 ... a-cmd-file)

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

Posted: 2015-06-21T04:59:05-07:00
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

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

Posted: 2015-06-21T09:04:32-07:00
by fmw42
I do not think so. But please review http://www.imagemagick.org/Usage/windows/#conversion