I am working with ImageMagick on a PHP system without the use of
"MagickWand"  I am creating very simple images with drawn squares,
triangles, etc, and recently noticed that ImageMagick is running MUCH
slower than gd, about 30 times slower.  For example, if producing an
image with 30 shapes on it, approximately 270 lines with stroke width
set to 5, producing the image takes approximately 1.5 seconds where gd
takes only .05 seconds.

 

I thought that a large part of this discrepancy could have to do with
antialiasing, which gd does not do but ImageMagick does.  Unfortunately,
I do not seem to be able to turn off antialiasing via the
setStrokeAntialias() command.  I created the following simple sample
program should produce two lines, one smooth and the other very jaggy,
but no matter how I play with it I get two smooth lines.

 

Any advice would be greatly appreciated:

 

<?php

 

            $image = new Imagick();

            $image->newImage(300, 50, new ImagickPixel("white"));

            $image->setImageFormat("png");

            

            // Create imagickdraw object, set default values for the
stroke object

            $draw = new ImagickDraw();

            $draw->setStrokeWidth(5);

            $draw->setStrokeColor(new ImagickPixel("black"));

            $draw->setStrokeLineCap(2); // 2 = round end cap for each
stroke line       

            $draw->setStrokeAntialias(1);                 

            

            $draw->line(10,40,  140, 10);

            $draw->line(140,10, 290, 40);

            $image->drawImage($draw);        // Incorporate the lines
into the image  

            

            // Create another imagickdraw object, this time with
antialiasing turned off

            $draw = new ImagickDraw();

            $draw->setStrokeWidth(5);

            $draw->setStrokeColor(new ImagickPixel("black"));

            $draw->setStrokeLineCap(2); // 2 = round end cap for each
stroke line       

            $draw->setStrokeAntialias(0);     

            

            $draw->line(10,10,    140,40);

            $draw->line(140,40, 290, 10);

            $image->drawImage($draw);        // Incorporate the lines
into the image  

            

            $image->scaleImage  (300*8  , 50*8);

            

            header("Content-type:  image/png");

            echo $image;

 

?>

_______________________________________________
Magick-users mailing list
[email protected]
http://studio.imagemagick.org/mailman/listinfo/magick-users

Reply via email to