chorg has asked for the wisdom of the Perl Monks concerning the following question:

Hello all once again,

I'd just like to extend thanks to the community here for the help and entertainment. I'm still very much learning perl, and the aid given here has been priceless.

Now, another question :) I'm using GD::Graph - and I've got GD 1.8.3, so I'd like to draw some JPEG graphs. I can't find in the manpage where to do that. How can I do that? Is it brutally hard - should I just stick to PNGs?
_______________________________________________
"Intelligence is a tool used achieve goals, however goals are not always chosen wisely..."

Replies are listed 'Best First'.
Re: GD::Graph action
by chromatic (Archbishop) on Dec 09, 2000 at 02:57 UTC
    I've not tried it, but can you use standard GD methods? Something like:

    print $gd->jpeg();

    If it inherits from GD::Image, I suspect it's possible. I don't have time to test it at the moment, but haven't seen any other suggestions. Flame away, all who know better!

Re: GD::Graph action
by Albannach (Monsignor) on Dec 09, 2000 at 04:01 UTC
    I'm guessing you want to use JPEGs to make sure that older browsers can view them, as the files will be bigger than PNGs and the images not as crisp (I'm still pissed about losing the GIF format as I do a lot of calculated (non-photographic) images).

    I just tested this out using the sample code from the GD Synopsis, and indeed  print $im->jpeg; creates a JPEG, but the odd thing was it appeared to be different from the PNG created with the same code. So, I think for a moment that this isn't right, and I try opening both images in the same viewer (our IT drones recently installed "Microsoft Photo Editor" here and it grabbed the PNG extension but not the JPEG). Sure enough, the files are virtually identical when you discount the fundamental difference between lossy and lossless formats, but MSPE had created a black and white grid on the background somehow. No matter, MSPE no longer grabs any extensions on this machine ;-).

    --
    I'd like to be able to assign to an luser