Page 1 of 1

Drop shadows

Posted: 2013-09-19T11:48:18-07:00
by stamatefilip
Hi,

Can anyone give me the commands to apply drop shadows to series on transparent png images? Basically, I want the script to go through all the png files in a folder, apply a drop shadow effect and then save and overwrite the previous image (which has no shadows).
I'd like the commands for Windows, if possible.

Thank you,
Filip.

Re: Drop shadows

Posted: 2013-09-19T12:01:46-07:00
by stamatefilip
Ok, so this

Code: Select all

convert image.png ( -clone 0 -background black -shadow 80x3+0+8 ) -reverse -background none -layers merge +repage image.png
gives me what I want for one image. All I need is how to apply it to an entire folder.
Of course, any other suggestions on a better command would be welcomed.

Re: Drop shadows

Posted: 2013-09-19T12:13:16-07:00
by snibgo
For shadows in IM, see http://www.imagemagick.org/Usage/blur/#shadow

For looping through files in Windows, type "help for" or "forfiles /?".

Re: Drop shadows

Posted: 2013-09-19T12:24:05-07:00
by stamatefilip
Yeah, sorry, but I can't figure it out.

In other words.. can anyone write it for me? :oops:

Re: Drop shadows

Posted: 2013-09-19T12:40:54-07:00
by Bonzo
I am not a Windows expert but try this untested code on a TEST FOLDER of images and see what happens:

Code: Select all

::Turn of displaying the code on the screen
 @echo off

 :: Read all the png images from the directory, modify and save with the same name
 for %%f in (%1\*.png) do ( convert "%%f"  ( -clone 0 -background black -shadow 80x3+0+8 ) -reverse -background none -layers merge +repage "%1.png" )
I have just tried and it does not work!

Re: Drop shadows

Posted: 2013-09-19T13:08:24-07:00
by snibgo
Your use of %1 is incorrect. Command on the same line as "for" mustn't be bracketed. Brackets are for putting the command on a separate line. For example, put one of these in a command file, and ALWAYS call it with the name of a directory.

Code: Select all

for %%f in (%1\*.png) do %IM%convert "%%f" ( -clone 0 -background black -shadow 80x3+0+8 ) -reverse -background none -layers merge +repage "%%f"

for %%f in (%1\*.png) do (
  %IM%convert "%%f" ^( -clone 0 -background black -shadow 80x3+0+8 ^) -reverse -background none -layers merge +repage "%%f"
)

Re: Drop shadows

Posted: 2013-09-19T13:18:50-07:00
by stamatefilip
@snibgo

That sort of works... it just seems to make several copies of the results, plus some files which only contain shadows. And the original files remain intact.

Re: Drop shadows

Posted: 2013-09-20T02:32:22-07:00
by Bonzo
Brackets are for putting the command on a separate line.
I will have to check that out when I have time snibgo as I have a couple of examples on my website similar to the code I posted.