Personnal signature in photos... Impossible to do...
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
Personnal signature in photos... Impossible to do...
Hello all,
I'm a Belgian user of Imagemagick and I'm looking for a smart way to watermark my photos.
I read alot of tutorials, but no one could help me
The image you see that has been done in Gimp, like that, you can see better what I'm hardly trying to do...
This is the steps I want to do:
1) add a rectangle of X pixel on the bottom of the image with an alpha channel Y
2) Annotate it with my name on the bottom right
X and Y should be 2 variables in the script...
I succeded to draw a rectangle but it append it! How to draw a rectangle with alpha on top of the image ?
If you can give me some way to do it or some examples with documentation it would be great
Thanks in advance...
I'm a Belgian user of Imagemagick and I'm looking for a smart way to watermark my photos.
I read alot of tutorials, but no one could help me
The image you see that has been done in Gimp, like that, you can see better what I'm hardly trying to do...
This is the steps I want to do:
1) add a rectangle of X pixel on the bottom of the image with an alpha channel Y
2) Annotate it with my name on the bottom right
X and Y should be 2 variables in the script...
I succeded to draw a rectangle but it append it! How to draw a rectangle with alpha on top of the image ?
If you can give me some way to do it or some examples with documentation it would be great
Thanks in advance...
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
See IM Examples, Annotate Images
Link in my signature.
Link in my signature.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
A little further are to examples with annotation on the image!!!
one method is to draw the dim box, then annotate into that box,
The other is to use a 'undercolor box' using a semi-transparent color.
It is there and even headed...
Labeling on top of the Image itself...
http://www.cit.gu.edu.au/~anthony/graph ... /#label_on
Just modify the example as appropriate! Of course you may need to know how wide the image is to do it properly.
Here just for you I'll create another example
The first line just extracts the width of the image being annotated
the convert then creates a caption with a semi-transparent background and overlays this
ontop of the image at the bottom. Note As I am using the latest IM I did NOT set a pointsize for the caption, but let it try to fill the given space at the best size posible.
try different heights for the caption box to adjust. and selete the desired font.
This has been added to the annotation page bt using the dragon image.
one method is to draw the dim box, then annotate into that box,
The other is to use a 'undercolor box' using a semi-transparent color.
It is there and even headed...
Labeling on top of the Image itself...
http://www.cit.gu.edu.au/~anthony/graph ... /#label_on
Just modify the example as appropriate! Of course you may need to know how wide the image is to do it properly.
Here just for you I'll create another example
The first line just extracts the width of the image being annotated
Code: Select all
width=`identify -format %w logo:`
convert -size ${width}x80 -fill white -background '#0008' \
caption:'This is the Imagemagick Logo -- Annotated using Caption' \
+size logo: +swap -gravity south -composite caption_overlay.jpg
ontop of the image at the bottom. Note As I am using the latest IM I did NOT set a pointsize for the caption, but let it try to fill the given space at the best size posible.
try different heights for the caption box to adjust. and selete the desired font.
This has been added to the annotation page bt using the dragon image.
Last edited by anthony on 2007-01-17T16:49:11-07:00, edited 1 time in total.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
Re: Personnal signature in photos... Impossible to do...
Hello,
Sorry to dig up old topics but I'm wondering if it is possible to make a gradient of that background.
Instead of having a rectangle in the bottom filled with the same color, would it be possible to make an horizontal gradient, from transparent to that color ?
Thanks !
Sorry to dig up old topics but I'm wondering if it is possible to make a gradient of that background.
Instead of having a rectangle in the bottom filled with the same color, would it be possible to make an horizontal gradient, from transparent to that color ?
Thanks !
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Personnal signature in photos... Impossible to do...
make a gradient image the same width as your image and desired height, label it with label: or caption:, then append it to the bottom of your image.
see
http://www.imagemagick.org/Usage/canvas/#gradient
http://www.imagemagick.org/Usage/text/
http://www.imagemagick.org/Usage/layers/#append
see
http://www.imagemagick.org/Usage/canvas/#gradient
http://www.imagemagick.org/Usage/text/
http://www.imagemagick.org/Usage/layers/#append
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
Re: Personnal signature in photos... Impossible to do...
Hello,
Thanks for the reply.
That's the question, I'm wondering how to make that rectangle on the top.
I'm trying to split up operations like:
Currently I'm using this: http://www.imagemagick.org/Usage/annotating/ (see the Auto-Sized Caption chapter)
Thx for the help !
Thanks for the reply.
That's the question, I'm wondering how to make that rectangle on the top.
I'm trying to split up operations like:
- Drawing rectangle with gradient and put it on the original image at south.
- Draw text on the top of that image
Currently I'm using this: http://www.imagemagick.org/Usage/annotating/ (see the Auto-Sized Caption chapter)
Thx for the help !
Re: Personnal signature in photos... Impossible to do...
This is in php but you will get the idea - same as the image in your first post with a gradiant:
On the image itself with transparency
Code: Select all
$input = 'House.jpg';
$size = getimagesize( $input );
$cmd = " $input ( -size {$size[0]}x30 gradient:black-white ".
" -fill red -pointsize 16 -gravity center".
" -annotate +0+0 \"Caption\" -flatten ) -append ";
exec("convert $cmd caption_size.jpg");
Code: Select all
<?php
$input = 'House.jpg';
$size = getimagesize( $input );
$cmd = " $input ( -size {$size[0]}x30 gradient:none-black ".
" -fill red -pointsize 16 -gravity center".
" -annotate +0+0 \"Caption\" ) -gravity south -composite ";
exec("convert $cmd caption_size.jpg");
?>
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
Re: Personnal signature in photos... Impossible to do...
Hello,
Thanks for the script, it helped me a bit.
I'm trying to split the problem into different parts so I can understand the commands.
I already splitted up the gradient bar creation using this command:
Now, I'm using this to add it to the original image:
Now I need to find how to add a transparent text into the gradient.png bar before including it in the final image ($IMAGE)... any idea on this ?
Thanks for the script, it helped me a bit.
I'm trying to split the problem into different parts so I can understand the commands.
I already splitted up the gradient bar creation using this command:
Code: Select all
convert -size 30x1024 gradient:none-black -rotate -90 +repage gradient.png
Code: Select all
composite -gravity South gradient.png $IMAGE $IMAGE
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Personnal signature in photos... Impossible to do...
You cannot draw transparent text. But you can draw it in some color say red and then make red transparent.
convert -size 200x100 gradient: grad_tmp.png
convert grad_tmp.png -gravity center -fill red -pointsize 24 +antialias -draw "text 0,0 'TESTING'" -transparent red grad_tmp5.png
convert -size 200x100 gradient: grad_tmp.png
convert grad_tmp.png -gravity center -fill red -pointsize 24 +antialias -draw "text 0,0 'TESTING'" -transparent red grad_tmp5.png
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Personnal signature in photos... Impossible to do...
DON'T DO THAT!
Text with antialiasing turned off sucks! and that technique only works with anti-aliased text.
The solution is to create your gradient image, and a separate text image, then use the text image as a 'cookie cutter' for your gradient.
For example
+ ->
See DstIn and DstOut
http://www.imagemagick.org/Usage/compose/#dstin
The gradient can be semi-transparent or anything you like.
Text with antialiasing turned off sucks! and that technique only works with anti-aliased text.
The solution is to create your gradient image, and a separate text image, then use the text image as a 'cookie cutter' for your gradient.
For example
Code: Select all
convert -size 200x100 gradient: gradient.png
convert -size 200x100 -background none -gravity center \
label:"Testing" png32:gradient_text_cutter.png
convert gradient.png gradient_text_cutter.png \
-alpha set -compose DstOut -composite png32:gradient_text_hole.png
See DstIn and DstOut
http://www.imagemagick.org/Usage/compose/#dstin
The gradient can be semi-transparent or anything you like.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Personnal signature in photos... Impossible to do...
I believe Anthony means not to use aliased text (+antialias). His method (which I was about to add to a similar example to my text above above) is better as the mask image can have anti-aliased text (-antialias or default), which means the text is smoothed near its boundary and not stair-stepped. I was going to suggest making the same mask, but use -compose copy_opacity to add it as the transparency channel. See http://www.imagemagick.org/Usage/compose/#copyopacity
-
- Posts: 14
- Joined: 2007-01-15T13:54:49-07:00
Re: Personnal signature in photos... Impossible to do...
When I do those commands, the gradient.png is ok, but the gradient_text_cutter.png is black.anthony wrote: For exampleCode: Select all
convert -size 200x100 gradient: gradient.png convert -size 200x100 -background none -gravity center \ label:"Testing" png32:gradient_text_cutter.png convert gradient.png gradient_text_cutter.png \ -alpha set -compose DstOut -composite png32:gradient_text_hole.png
I also had to remove the png32 in front of the filenames to get them working.
About -compose DstOut, it's DstOut or Dst_Out ? (it's currently doing nothing because of the former problem with text.)
I'm using the binary version of Imagemagick(6.6.5) on Snow Leopard, I'm now compiling the macports version(6.6.6), I'll report here when it's finished because it's taking some time to get compiled.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Personnal signature in photos... Impossible to do...
there are some issues with PNG that are being worked on and you should upgrade to the most current version if possible to get the most current improvements to PNG handling.
see viewtopic.php?f=3&t=17771
and viewtopic.php?f=3&t=17748
try creating all your PNG files with PNG32: prefacing the output filenames. See if that works.
The following works fine for me on IM 6.6.6.10 Q16 (hdri) Mac OSX Tiger
convert -size 200x100 gradient: gradient.png
convert -size 200x100 -background none -gravity center \
label:"Testing" png32:gradient_text_cutter.png
convert gradient.png gradient_text_cutter.png \
-alpha set -compose DstOut -composite png32:gradient_text_hole.png
see viewtopic.php?f=3&t=17771
and viewtopic.php?f=3&t=17748
try creating all your PNG files with PNG32: prefacing the output filenames. See if that works.
The following works fine for me on IM 6.6.6.10 Q16 (hdri) Mac OSX Tiger
convert -size 200x100 gradient: gradient.png
convert -size 200x100 -background none -gravity center \
label:"Testing" png32:gradient_text_cutter.png
convert gradient.png gradient_text_cutter.png \
-alpha set -compose DstOut -composite png32:gradient_text_hole.png