How to keep a layer without moving from a shadow layer ?

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
rcspam
Posts: 1
Joined: 2015-06-12T02:45:57-07:00
Authentication code: 6789

How to keep a layer without moving from a shadow layer ?

Post by rcspam »

Hi,
I need to a text with a shadow image. When i take this:
convert -background none -fill white -pointsize 72 label:'Shadow' -trim \( +clone -background Navy -shadow 80x3+10+10 \) +swap -background none -layers merge shadow1.png
then
convert -background none -fill white -pointsize 72 label:'Shadow' -trim \( +clone -background Navy -shadow 80x5+5+5 \) +swap -background none -layers merge shadow2.png
the text layer of shadow2.png move from text layer shadow1.png.
I want only my shadow layer to move.

Have you a solution for that ?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to keep a layer without moving from a shadow layer ?

Post by snibgo »

"-layers merge" makes the result just large enough to contain all the layers. One command creates a shadow to the north of the lettering; the other doesn't.

One solution is to add a third layer to each image, large enough to contain the shadow. This will be the largest layer, so the others will fit into it.

Code: Select all

convert -background none -fill white -pointsize 72 label:'Shadow' -trim ( +clone -alpha transparent -bordercolor None -border 50 -repage -25-25 ) +swap  ( +clone -background Navy -shadow 80x3+10+10 ) +swap -background none -layers merge +repage s1.png

convert -background none -fill white -pointsize 72 label:'Shadow' -trim ( +clone -alpha transparent -bordercolor None -border 50 -repage -25-25 ) +swap  ( +clone -background Navy -shadow 80x5+5+5 ) +swap -background none -layers merge +repage s2.png
snibgo's IM pages: im.snibgo.com
Post Reply