Drawing "curved" text?

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

Post by Bonzo »

Yes you can draw text in an arc.

Here is a link to Anthonys new example page with some ideas http://www.cit.gu.edu.au/~anthony/graph ... erspective
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I do not understand what is happening here and it needs some work - I am short of time tonight.

Code: Select all

<?php

exec("/usr/local/bin/convert -size 500x150 xc:black -fill white -pointsize 35 -gravity center -draw \"text 0,0 'This is some text to bend' \" text.gif");

exec("/usr/local/bin/composite gradiant.gif text.gif -displace 20 curved.gif");

?>
<img src="gradiant.gif"><br>
<img src="text.gif"><br>
<img src="curved.gif"><br>
http://www.rubblewebs.co.uk/imagemagick ... curved.php
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Post by anthony »

The composite -displace function uses a grey image to define a relative displacement to the LOOKUP of the source image.

see IM examples Composite Displacement Maps
http://www.cit.gu.edu.au/~anthony/graph ... /#displace
for details.

Note displacement maps are a lot harder to understand than positional distortion maps.
(see reference in previous message). however it can reference displaced positions outside the source image, which allows it to properly handle 'undefined' pixels. It also lets you adjust the amount of displacement according to the arguments given...

As for your problem. You are displacing using a 'XY' displacement.
You want just a Y displacement. Use -displace 0x20 instead.

PS: you did not give the code you used to generate your gradient :-)
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Post by Bonzo »

I will have another go later Anthony. I am afraid I didn't post the code that generated the gradiant as I cheated and did it with GIMP :?
Ryland

Re:

Post by Ryland »

anthony wrote:You want just a Y displacement. Use -displace 0x20 instead.
Do you know what the PerlMagick syntax for this is?

Should be something like:

Code: Select all

$img->Composite(image=>$map,compose=>'Displace',[parameter]=>'0x20',gravity=>'Center');
...except I don't know what the name of [parameter] is supposed to be
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Drawing "curved" text?

Post by anthony »

Ryland wrote:Do you know what the PerlMagick syntax for this is?

Should be something like:

Code: Select all

$img->Composite(image=>$map,compose=>'Displace',[parameter]=>'0x20',gravity=>'Center');
...except I don't know what the name of [parameter] is supposed to be
That sounds about right, though it may not be implemented.
In "composite" the parameter is saved into a composite option called "displace_geometry" however I can not find any usage of that option in
PerlMagick source code.

Looks like you may need to report a bug in the bugs forum.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Ryland

Re: Drawing "curved" text?

Post by Ryland »

anthony wrote:That sounds about right, though it may not be implemented.
In "composite" the parameter is saved into a composite option called "displace_geometry" however I can not find any usage of that option in
PerlMagick source code.

Looks like you may need to report a bug in the bugs forum.
I figured it out, actually, the parameter name is "blend". I didn't know which parameter it was, but there was a list of all parameter names on the PerlMagick page, so I just substituted them in one by one until I found the one that worked. For my money, "blend" isn't a very intuitive name for it, but at least it's in there.
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: Drawing "curved" text?

Post by anthony »

It makes some sense to me. blend and dissolve are almost the same routine.

Both routines multiplies the alpha channel value of the image with the given factors, then dissolve overlays the source on the destination while blend adds the source on the destination. Blend is symmetrical, while dissolve isn't.

The only other difference is the handling of a single factor. Blend sets the second factor to the inverse of the first, dissolve does not. Dissolve however treats a single factor larger than 100% as meaning dissolve the second image. If both images are filly opaque this difference has little effect on the outcome.

See IM Examples
http://www.imagemagick.org/Usage/compose/#dissolve
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply