Adding arc text to image

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
superwizzard

Adding arc text to image

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Adding arc text to image

Post 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 ?
superwizzard

Re: Adding arc text to image

Post 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
superwizzard

Re: Adding arc text to image

Post 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.
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Adding arc text to image

Post by Bonzo »

The code below created this image:
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 :?
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Adding arc text to image

Post 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!
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
superwizzard

Re: Adding arc text to image

Post 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
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: Adding arc text to image

Post by Bonzo »

You should be able to add a -geometry +0+0 ( +or- horizontal offset +or- vertical offset ) after the -gravity north.
Post Reply