The backgroud pic: background
The final effect: gif effect
How do I make the red heart move and cover the background text?
I have tried this:
Convert back.png ( -clone1 -gravity center -geometry +10+10 heart.png ) (-clone 1 *******)
This just moves the heart, but did not cover the text.
How do I make the red heart move and mask part of the background text?
With mask?
Here is one way using Imagemagick. First I need to crop out the heart shape from one of your animation frames, since you did not provide that.
Heart Image:
Background Image:
First, I create a new folder on my desktop called test and put both images into it.
Here is the code in (Bash) Unix syntax.
I start backwards from the right side towards the left of the background. The i indices are then reversed using j=(55-i) for later combining in alphabetic order. The jj computation adds a leading zero to the indices less than 10 so that all frames are listed in the test folder in alphabetic order.
For each frame, it extracts the alpha channel of the background and draws a black rectangle on the right side and then puts that result back into the alpha channel of the background image using -compose copy_opacity -composite
. This effectively puts transparency where the pink letters are. Then I composite the heart image as the corresponding left edge of where I had drawn the black rectangle.
After the loop finishes, I gather all the frames from the test directory with names starting with tmp_ and create a gif animation that I write to the desktop.
x=564
for ((i=0; i<56; i++)); do
j=$((55-i))
jj=`printf "%02d\n" $j`
convert background.png \
\( -clone 0 -alpha extract -fill black -draw "rectangle $x,0 639,123" \) \
-alpha off -compose copy_opacity -composite \
heartshape.png -geometry +${x}+28 -compose over -composite tmp_$jj.gif
x=$((x-8))
done
convert -dispose background -delay 10 tmp_*.gif -loop 0 ../heart_animation.gif
Note that Windows Imagemagick and scripting syntax is different. If some kind Windows user wants to post the conversion, that would be great.