in reply to Re^2: GD VS ImageMagick Again...
in thread GD VS ImageMagick Again...

Thank you Burak and Joost, I tried to test these modules comparing (to my eyes only) the quality of the lines produced for the same png generation. IM seemed to perform a little better but not too much. When I draw on files 400x300px there are always some nasty little steps (sorry for my terrible english ;) ), especially with arcs or diagonal lines.
I tried to draw a bigger image and to reduce it with IM and the result was far better. However in this manner there's much more elaboration for my poor pc.
How is it possible that IM draws better when it manipulates than when it does the direct activity? Draw bigger and resize is the only solution to improve quality or there are smarter unfathomable ways?
I'd like to create some chart creation module, no matter with GD or IM, It would be good if it was possible to achieve this line quality http://www.advsofteng.com/gallery_polar.html with images ranging usually from 400 to 600px
In the past I read a thred discussing what is the quality in a chart. A chart shouldn't be too beautiful... That's not an answer.
To sum up: How can I draw lines, arcs, etc without those little steps I mentioned before? I read somewhere that there are modules using the cairo library. Are there any other library? Which library are used by GD and IM? Do you know how to interact with them with perl and which should be the state of the art on linux?
Is this a good way to proceed? Thanks in advance for every kind suggestion my dear monks

Replies are listed 'Best First'.
Re^4: GD VS ImageMagick Again...
by BrowserUk (Patriarch) on Jul 30, 2007 at 15:36 UTC

    There are several things you must do to get the best quality images out of GD. The defaults it uses are set up to be compatible with earlier versions of GD and so do not produce the best output unless you adjust them.

    1. Ensure that you create TrueColor images.

      Eg. my $img = GD::Image->new( 600, 400, 1 ); Without the 3rd parameter, it will produce paletized images.

    2. Use the AntiAliasing support ($img->setAntiAliased( $color )).

      Note that you need to set the color you are going to draw with to be the AntiAliased color before you draw with it. And switch it it, each time you draw with a different color.

      Also, when drawing in a foreground color that is not a good contrast with the background colors over which you are drawing, antialiasing can result in faded or fuzzy lines.

      Use $img->setAntiAliasedDontBlend( $color, 1 ) to disable antialiasing over particular color(s). It takes a little experiementation to work out what looks best.

    3. Use TrueType fonts.

      I've had trouble with this in the past, so I won't add anything more.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.