fmw42 wrote:
[...]
convert cotegaspesie4.jpg -resize 50% cotegaspesie4_sm.jpg
infile1="cotegaspesie4_sm.jpg"
infile2="bkgd_photo.gif"
ww=`convert $infile1 -ping -format "%w" info:`
hh=`convert $infile1 -ping -format "%h" info:`
wwm1=`convert xc: -format "%[fx:$ww-1]" info:`
hhm1=`convert xc: -format "%[fx:$hh-1]" info:`
convert $infile1 \
\( +clone -threshold "100%" -fill white -draw "roundrectangle 1,1 $wwm1,$hhm1 25,25" \) \
-alpha off -compose CopyOpacity -composite \
-background none -compose Over -gravity center -extent ${ww}x${hh} \
\( +clone -background black -shadow 100x5+10+10 \) +swap \
-background none -flatten $infile2 +swap -gravity center -composite \
cotegaspesie4_sm_rounded_bkgd.png
[...]
If this is not what you need, please clarify further.
Here is what I understood from your first manipulation: (correct me if I'm wrong)
infile1="cotegaspesie4_sm.jpg"
infile2="bkgd_photo.gif"
Desc: Assign image files
ww=`convert $infile1 -ping -format "%w" info:`
hh=`convert $infile1 -ping -format "%h" info:`
Desc: ww and hh are the width and height of infile1.
wwm1=`convert xc: -format "%[fx:$ww-1]" info:`
hhm1=`convert xc: -format "%[fx:$hh-1]" info:`
Desc: wwm1 and hhm1 are the ww and hh minus 1. (reduced)
1 convert $infile1 \
Desc: - Load infile1 image in a new layer (layer 0).
Result: - Layer 0 (current layer) is the infile1 image.
2 \( +clone -threshold "100%" -fill white -draw "roundrectangle 1,1 $wwm1,$hhm1 25,25" \) \
Desc: - Create a new layer (layer 1) with a copy of layer 0, make it back, and draw a white rounded rectangle
with reduced size. (why?)
Result: - The current layer image (layer 1) is a rectangular white image with black rounded corners with reduced size wrt infile1's.
- Layer 0 is the infile1 image.
3a -alpha off -compose CopyOpacity -composite \
Desc: - Remove alpha channel from the current layer image (layer 1).
- The composition operation will consist in copying each pixel of the source image to the alpha channel of the corresponding pixel in the destination image.
- Apply the composition (for all the pixels) where the source image is the current layer's (layer 1) and the destination image is layer 0's.
Result: - Layer 0 is the reduced infile1 image with transparent rounded corners.
- Layer 1 vanishes. (right?)
- Layer 0 becomes the current layer.
3b -background none -compose Over -gravity center -extent ${ww}x${hh} \
Desc: - Set the background color to transparent.
- The composition operation will consist in ? (my guess: simply overlay the source image on the destination image)
- Set the size of the current layer (layer 0) to the infile1 image's while keeping it centered.
Result: - The current layer image (layer 0) is the infile1 image with transparent rounded corners with the original size.
4 \( +clone -background black -shadow 100x5+10+10 \) +swap \
Desc: - Create a new layer (layer 1) with a copy of the layer 0 image. (Layer 1 is now the current layer)
- Paint it black (but of course it still preserve the transparent rounded corners)
- Add a shadow effect (with offset by +10+10).
- Exchange the image between the 2 layers.
Result: - Layer 0 is now the shadow effect.
- Layer 1 is now the infile1 image with transparent rounded corners (original size).
- Layer 1 is still the current layer.
5 -background none -flatten \
Desc: - Set the background color to transparent. (why?)
- Both layers are rationalized to a single one (layer 0).
Result: - Layer 0 is now the infile1 image with transparent rounded corners with shadow.
- Layer 1 vanishes. (right?)
- Layer 0 becomes the current layer.
6 $infile2 +swap -gravity center -composite cotegaspesie4_sm_rounded_bkgd.png
Desc: - Load infile2 image in a new layer (layer 1) which becomes the current layer.
- Exchange the image between the 2 layers. (Layer 1 is still the current layer which is now the infile1 image with transparent rounded corners with shadow)
- Before the composition begins, the source image will be centerized wrt the destination image.
- Apply the composition (for all pixels) where the source image is the current layer (layer 1) and the destination image is layer 0's (infile2 image).
Result: - Layer 0 is the infile1 image with transparent rounded corners with shadow centered over the infile2 image.
- Layer 1 vanishes. (right?)
- Layer 0 becomes the current layer (which is the one that is saved as cotegaspesie4_sm_rounded_bkgd.png)