Page 1 of 1
Adding arc text to image
Posted: 2009-07-05T07:12:31-07:00
by superwizzard
Hi
I have an image saved as image.jpg and I wish to add text to it that is in the form of an arc. I have tried some examples from the documentation and can generate arc text but cannot add it to an image (without removing whats in the background).
Thanks in advance
Re: Adding arc text to image
Posted: 2009-07-05T07:18:05-07:00
by Bonzo
You will need to create your text as an image with a transparent background and place it over the original image.
What code do you have so far and IM version ?
Re: Adding arc text to image
Posted: 2009-07-05T07:30:24-07:00
by superwizzard
Thanks for the reply
This is my version info:
Version: ImageMagick 6.4.5 2008-11-13 Q16 OpenMP
http://www.imagemagick.org
Copyright: Copyright (C) 1999-2008 ImageMagick Studio LLC
My current command does not work but none the less here it is:
convert image.jpg --pointsize 15 -fill white -annotate 0 "This Text Needs to be Curved" image_edit.jpg
Re: Adding arc text to image
Posted: 2009-07-05T07:31:17-07:00
by superwizzard
I managed to get the text to curve but never manage to add it to an image. I cannot find the command I used tough.
Re: Adding arc text to image
Posted: 2009-07-05T10:37:05-07:00
by Bonzo
The code below created this image:
Code: Select all
convert ( background_image.jpg -thumbnail 200x200 -write mpr:image +delete ) \
( -pointsize 20 -fill red -background none label:"Cottenham horse show" -virtual-pixel transparent -distort arc 120 -write mpr:arc +delete ) \
mpr:image mpr:arc -gravity north -composite combined.jpg
You do not say how you are using the code; I did it in php and have removed the php parts from the code. I also needed to resize my image as it was a bit to big.
if your text is always the same it would be quicker to create your text and just overlay it each time:
Code: Select all
convert background_image.jpg arc.png -gravity north -composite combined.jpg
I managed to get the text to curve but never manage to add it to an image. I cannot find the command I used tough.
Thats the problem when you are trying differnt things
Re: Adding arc text to image
Posted: 2009-07-05T19:51:05-07:00
by anthony
Reordering avoids the need for saving the image into a mpr: register.
Also first parenthesis is not needed, as their are no images in memory yet!
Code: Select all
convert background_image.jpg -thumbnail 200x200 \
( -pointsize 20 -fill red -background none label:"Cottenham horse show" \
-virtual-pixel transparent -distort arc 120 ) \
-gravity north -composite combined.jpg
the above is basically the 'Arc Compund Font' from
http://www.imagemagick.org/Usage/fonts/
their are lots of other fonts and styles listed.
Contributions for more compound fonts are always welcome!
Re: Adding arc text to image
Posted: 2009-07-06T06:52:56-07:00
by superwizzard
Hi
Thanks a lot, both the code works. One more thing, when combining the images how do I offset the arc vertically? At the moment the text is being added to the top of the image and I want it about 1/3 the way down.
Regards
Re: Adding arc text to image
Posted: 2009-07-06T07:36:36-07:00
by Bonzo
You should be able to add a -geometry +0+0 ( +or- horizontal offset +or- vertical offset ) after the -gravity north.