Page 2 of 2
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-04T15:10:09-07:00
by The Transporter
Yeah it works perfectly now
I'm using imagemagick 6.6.6-3 from macports.
This is the result:
Now the script to do this:
Code: Select all
#!/bin/sh
IMAGE=$1
CAPTION="BMW's By Night | Photos by Pol D. | through-my-eyes.be"
FONT="./fonts/BMW75.TTF"
BORDERWIDTH="6"
BORDERWIDTH2="1"
width=`identify -format "%w" $IMAGE`
heigth=`identify -format "%h" $IMAGE`
convert -size 20x${width} gradient:none-white -rotate -90 +repage gradient.png
convert -size ${width}x20 -background none -fill white -font $FONT -gravity East label:"`echo $CAPTION`" text_mask.png
convert gradient.png text_mask.png -alpha set -compose Dst_Out -composite gradient.png
composite -gravity South gradient.png $IMAGE $IMAGE
rm gradient.png text_mask.png
mogrify -bordercolor white -border "${BORDERWIDTH}x${BORDERWIDTH}" $IMAGE
mogrify -bordercolor black -border "${BORDERWIDTH2}x${BORDERWIDTH2}" $IMAGE
The next part of the trick now would be to paint the font with a gradient but in the other direction.
In this example, a cool stuff would be to have the text in gradient FROM black TO transparent, do you think it can be doable also ?
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-04T15:26:34-07:00
by Bonzo
Out of interest have you seen this site:
http://www.mariusaasheim.com/
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-04T15:35:49-07:00
by The Transporter
breathless !!! Woaw ! I still need to learn how to make HDR !!!
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-04T18:02:39-07:00
by anthony
NOTE on your use of gradient with a hole.
With a long gradient the hole in it will be basically surrounded by a white overlay.
If that was overlay on a pure white image, your text 'hole' will vanish.
To make your label work properly you need to not only lighten the background using a semi-transparent gradient, but also darken the foreground slightly with an black semi-transparency.
This is talked about in IM Examples, Annotating Images, Annotating On top of the Image
http://www.imagemagick.org/Usage/annotating/#anno_on
NOTE that once you have an overlay image, you do not need to re-create it (unless the text changes), just compose it onto each image you want to label.
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-04T18:06:49-07:00
by anthony
Very nice images, This guy certainly knows about photography, including using telescopes, though seems to like cars and car racing more than anything else. However while his bottom annotation label is good, the water mark he adds to the middle of the is not so good. It should always be visible to some extent in every photo, but it only is apparent in a few photos, like his moon shots.
Of course people who want such images would want them at maximum quality, but still he should protect them better.
Watermarking techniques.
http://www.imagemagick.org/Usage/annota ... termarking
Re: Personnal signature in photos... Impossible to do...
Posted: 2011-01-06T05:52:48-07:00
by The Transporter
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