[magick-users] Fw: How to text wrap with gradient fill

Anthony Thyssen A.Thyssen at griffith.edu.au
Mon Feb 2 19:08:36 PST 2009


On Mon, 2 Feb 2009 01:10:09 -0800 (PST)
magick-users-bounces at imagemagick.org wrote:
| HI ,
| I need to annotate a image with a text whose length could wary.. I
| need to text wrap it..and i also want to have gradient fill for the
| text.. if i use caption and label iam able to wrap the text but
| gradient fill doenst seem to work.. with annotate there is no wrap..
| please help!! thank you
| 
| Mini
| 
Do the caption: but with a transparent or 'none' background color
you can then underlay that onto a gradient, or whatever background you
like!

Of course as IM can't generate a gradient image to match an existing image
you can't use  gradient:

You can however use a -sparse-color  operator to generate the gradient,
with the right scale as it allows you to use percent escapes to set values.
   http://www.imagemagick.org/Usage/canvas/#barycentric

convert  -background None  -size 100x  \
     caption:'A really long line generating a image of unknown height' \
     \( +clone +matte \
        -sparse-color Barycentric '0,0 White  0,%[fx:h-1] DodgerBlue' \
     \) +swap -composite   result.gif

You can also use percent escapes in -distort arguments too!
In the future some other arguments may also percent escapes, such
as -size, (in which case you may be able to use 'gradient:' for the above
instead) though this is as yet undecided.


This is NOT a well published or exampled technique, and is still open to
discussion by the ImageMagcik developers as to how usefull and wide spead
this should become, especially as '%' is already a well known special
flag for geometry-style arguments, which could cause confusion and problems.

I would not rely on it.

In fact the only other example is for the "Displaced Fractured Mirror"
  http://www.imagemagick.org/Usage/displace/#displace_mirror



  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
    You said the learning curve was steep, but neglected to mention the
    roller coaster ride in the middle! -- Anni <afactor at ozemail.com.au>
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list