Curved dymanic length text on a flower image in background

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
vikrammandal

Curved dymanic length text on a flower image in background

Post by vikrammandal »

Hi,

I need to created a curved text on a flower image in the background. The curved text also needs to be rotated in certain direction/angle

Probably I can use Arc Distortion Map method as described in http://www.imagemagick.org/Usage/distorts/

Or may be -wave is a better option as my text are going to be of dynamic length.

So i guess i first create a text image with transparent background (jpeg don't support transparency) and them combine it with my flower image?

Or is there better approaches ?

And how best to handle dynamic length text.. i guess the width/height would has lot of variance like font, pointsize, number of characters, screen resolution

Thanks a lot in advance for sharing your thoughts.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Curved dymanic length text on a flower image in background

Post by anthony »

The new -distort Arc method attempts to preserve the aspect ratio of text as much as posible, so if you resize your Dynamic text to the right length then that length
will be preserved when it is arc'ed into a circle.

Better still generate your text at twice the normal resolution (-density 144), arc it
and shrink the result.

Also not that the arced image has a virtual canvas offset, to position the text relative to the center of the arc. That point will never change so if the text length is the same and the arc angle is the same then the text will be in the same position relative to that 'center' point. You could also specify a 'top edge' to scale the text, to fit it to the flower stem even better.

Make sure you have the latest version of IM for all of this. More options are comming.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vikrammandal

Re: Curved dymanic length text on a flower image in background

Post by vikrammandal »

ok. thanks. I see now the IM v6.3.5-5 has been released... the arc thing in the latest version only. Thanks you.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Curved dymanic length text on a flower image in background

Post by anthony »

I am right now working on improving the distortion function, so things are happening.

The next release of IM will remove the virtual offset from the "-distort" method while
adding to the 'virtual canvas' usage features using "+distort". This however has not been written up in the examples as yet, so give it a week, for the next set of features.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vikrammandal

Re: Curved dymanic length text on a flower image in background

Post by vikrammandal »

Hi Antony, thanks for the great work.

I have tried the distort arc.. and I see some problem of dangling text edges :lol:
Here is one of those generated image http://www.fivee.in/fileadmin/map_11867 ... XfKDv8.png

see both "P" and the last "t"

Code: Select all

C:\ImageMagick/convert E:/typo3temp/map_1186718996_e4bLcFCR8n.png -background none -distort arc 50 E:/typo3temp/map_1186718996_e4bLcFCR8n.png
OS: WinXP

Please advice.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Curved dymanic length text on a flower image in background

Post by anthony »

You did not tell Im what to do for pixels that 'missed' the image. That is the virtual pixels.

try adding -virtual-pixel background or -virtual-pixel transparent
before the -distort operator. both would mean the same thing in your case.

If you Change your backgound to some other color you can see the outline of the distorted image, just for testing.

You can rotate the result at the same time using (for example)

Code: Select all

    -distort arc '50,-45'
or set a top-radius (which also controls scaling)
by adding a thrid argument.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
vikrammandal

Re: Curved dymanic length text on a flower image in background

Post by vikrammandal »

Worked like a charm! :D
Post Reply