recursive transparency (windows commandline)

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
RAB74
Posts: 1
Joined: 2014-07-11T03:10:30-07:00
Authentication code: 6789

recursive transparency (windows commandline)

Post by RAB74 »

Dear list,

I am a brand new ImageMagick user (working in Windows 7) so forgive my ignorance but I would like to recurse this command to convert the background of a png to transparent, overwriting the original files (rather than copying to a new folder)

Code: Select all

FOR %G IN (*.png) DO convert %G -transparent white test \%G
By following the thread here viewtopic.php?f=1&t=14112&start=15 and example here
I put together this command

Code: Select all

FOR /R %%a IN (*.png) DO convert -transparent white "%%~a" "%%~dpna.png
getting this error

Code: Select all

%%a was unexpected at this time.
Altering to:

Code: Select all

for /R %i IN (*.png) DO convert -transparent white "%i" "%%~dpna.png"
(based on another batch script I have) runs but does not overwrite the output to the original files instead to a png named %~dpna in the top folder
If anyone has a moment to help me tweak the code I would really appreciate the advice!

Thanks for reading
Rebecca
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: recursive transparency (windows commandline)

Post by snibgo »

If you are typing at the command line, don't double percent characters.

If you are running BAT files, do double percent characters.

Your last command sets up variable %i but uses both %i and %a.
snibgo's IM pages: im.snibgo.com
Post Reply