Page 1 of 1

Need help with merging images and adding drop shadow

Posted: 2015-05-04T21:10:53-07:00
by jauson
I've created a working script that does this separately, but no luck trying to have it do it in 1 command.

Code: Select all

convert 1.png \
    \( +clone  -background gray10 -shadow 80x14+25+25 \) +swap \
    -background none   -layers merge  +repage   1m.png

Code: Select all

convert \
        -page +2400+0   1m.png   \
        -page +2000+0   2m.png   \
        -page +1600+0   3m.png   \
        -page +1200+0   4m.png \
        -page +800+0    5m.png  \
        -page +400+0    6m.png \
        -page +0+0      7m.png \
        -background none  -layers merge  +repage  layerstest.png

What I'm trying to do is something like this with no luck:

Code: Select all

convert \
        -page +2400+0   1m.png   \
        \( +clone  -background gray45  -shadow 10x30+0+0 \) +swap -background none   -layers merge \
        -page +2000+0   2m.png   \
        \( +clone  -background gray45  -shadow 10x30+0+0 \) +swap -background none   -layers merge \
        -page +1600+0   3m.png   \
        \( +clone  -background gray45  -shadow 10x30+0+0 \) +swap -background none   -layers merge \
        -page +1200+0   4m.png \
        -page +800+0    5m.png  \
        -page +400+0    6m.png \
        -page +0+0      7m.png \
        -background none  -layers merge  +repage  layerstest.png

Update, Ater a few more tries my working solution:

Code: Select all

convert \
        -page +2400+0   1m.png   \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +2000+0   2m.png   \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +1600+0   3m.png   \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +1200+0   4m.png \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +800+0    5m.png  \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +400+0    6m.png \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -page +0+0      7m.png \
        \( +clone  -background gray10 -shadow 80x14+25+25 \)  +swap -background none   \
        -background none  -layers merge  +repage  layerstest.png

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T02:01:38-07:00
by jauson
One problem I'm having is -page doesn't resize the layer like suggested.

For example:

-page 100x100+2400+0 1m.png

doesn't give me a 100x100 1m image at that offset.

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T03:05:12-07:00
by Bonzo
You could check out the examples here: http://www.imagemagick.org/Usage/layers/

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T13:52:35-07:00
by jauson
Thanks Bonzo, I've been there, the -page still isn't resizing. I must be missing something.

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T14:09:10-07:00
by Bonzo
I use this method to resize and move the image with the Anthony/Tomas Zathurecky code linked to above:

Code: Select all

convert \
    \( holocaust_tn.gif -thumbnail 500x500 \
          -background none  -rotate 5 -repage +0+0 \) \
    \
    \( spiral_stairs_tn.gif  -thumbnail 500x500 \
          -background none -rotate -15 -repage -90+60 \) \
    \( -clone 0   -background black -shadow 70x3+4+7 \
       -clone 1   -background black -compose DstATop -layers merge \
       -trim \) \
    \( -clone 2,0 -background none  -compose Over -layers merge \) \
    -delete 0--2 \
    \
    \( chinese_chess_tn.gif  -thumbnail 500x500 \
          -background none -rotate 20 -repage +60+90 \) \
    \( -clone 0   -background black -shadow 70x3+4+7 \
       -clone 1   -background black -compose DstATop -layers merge \
       -trim \) \
    \( -clone 2,0 -background none  -compose Over -layers merge \) \
    -delete 0--2 \
    \
    \( +clone -background black -shadow 70x3+4+7 \) +swap \
    -background none -compose Over -layers merge +repage \
    layers_of_shadows.png

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T14:44:56-07:00
by jauson
Am I wrong in thinking -page should be resizing a layer?

Re: Need help with merging images and adding drop shadow

Posted: 2015-05-05T16:44:17-07:00
by fmw42
As far as I know -page by itself does not resize the image data, but may pad or crop due to the virtual canvas it creates. See

http://www.imagemagick.org/Usage/basics/#page