Hello all,
I succeded to do what I wanted finally
Here is the whole script explained, for beginners who want to do the same... I help them also
Code: Select all
#!/bin/sh -x
IMAGE=$1
# The Caption
CAPTION="Set Your Caption Here"
# The Font Size
POINTSIZE="24"
# The path to a font.
FONT="./fonts/BMW75.TTF"
# Calculate the width of the original image.
width=`identify -format "%w" $IMAGE`
# Make a rectangular gradient from transparent to white, with a the width corresponding to the original image.
convert -size 20x${width}e gradient:none-white -rotate -90 +repage gradient.png
# Make a mask using the caption. Transparent background, white font.
convert -size x20 -background none -fill white -font $FONT -gravity East label:"`echo $CAPTION`" text_mask.png
# Make a mask using the caption. Transparent background, white font, width is from original image.
convert -size ${width}x20 -background none -fill white -font $FONT -gravity East label:"`echo $CAPTION`" text_mask2.png
# Calculate it's width
width2=`identify -format "%w" text_mask.png`
# Make a rectangular gradient from black to transparent, it's width is calculated from the text_mask.png
convert -size 20x${width2} gradient:black-none -rotate -90 +repage gradient2.png
# Replace the white color of the text with the gradient2.png and make a new image: text.png
convert gradient2.png text_mask.png -alpha set -compose Dst_In -composite text.png
# Crop the text.png
mogrify -crop ${width2}x20+0+0 text.png
# Make a new empty png image: empty.png
convert -size ${width}x20 xc:none empty.png
# Paste the text.png into that empty image and overwrite text.png
convert -gravity East empty.png text.png -compose Over -composite text.png
# Take the gradient remove the text.png from it, make it transparent.
convert gradient.png text_mask2.png -compose Dst_Out -composite gradient.png
# Take the gradient and paste the text.png over it.
convert gradient.png text.png -compose Over -composite gradient.png
# Copy the gradient.png on the south of the image.
composite -gravity South gradient.png $IMAGE $IMAGE
# Delete temporary files
rm empty.png gradient.png gradient2.png text_mask.png text.png
How to use this code:
1) Create a file: sig.sh, copy the code in it, then 'chmod +x' it.
2) Run this:
Maybe you'll see some improvements, just let me know !
Thanks again for your help... 4 years after