[magick-users] PerlMagick question $image->Read("gradient:orange-none") no longer works ?

Anthony Thyssen anthony at griffith.edu.au
Tue Sep 19 19:40:34 CDT 2006


Walter Higgins on  wrote...
| Hi,
|
| I've been using the following command to create a canvas which is a gradient going from orange to transparent..
|
|
| my $image = new Image::Magick();
|
| $image->Read("gradient:orange-none");
|
|
| This no longer seems to work in 6.2.9 (windows) - What I get is an
| orange canvas with no gradient at all.  Anyone know how I can create
| an orange-none gradient  in 6.2.9 using perlmagick ?

The "gradient:" image generator never did handle transparency.

But that does not mean all is lost.
  IM Examples, Gradients of Color
   http://www.cit.gu.edu.au/~anthony/graphics/imagick6/canvas/#gradient

=======8<--------
Note that "gradient:" will not handle transparent colors, only opaque
colors (at least at this time). If you want to create a gradient going
from some color to transparency, you need to do some alpha composition
trickiness.

For example here I create a solid color ('firebrick') canvas and a
standard gradient image the same size. The gradient is then copied into
the alpha channel of the first image.

    convert -size 100x100 xc:firebrick  gradient: \
            +matte -compose CopyOpacity -composite  gradient_firebrick.png

Of course as I used semi-transparent pixels in this gradient, I needed
to use the PNG image format, rather than JPEG.

=======8<--------

You make also like to look at 'Gradient Internals' that immediately
follows the above.


  Anthony Thyssen ( System Programmer )    <A.Thyssen at griffith.edu.au>
 -----------------------------------------------------------------------------
   "He may look like an idiot and talk like an idiot,
         but don't let that fool you.  He is an idiot."   -- Groucho Marx
 -----------------------------------------------------------------------------
     Anthony's Home is his Castle     http://www.cit.gu.edu.au/~anthony/


More information about the Magick-users mailing list