in reply to Image2HTML

You're doing far too much work for most of this. See how I did the task in my column. ImageToBlob means you don't have to fetch each pixel. A single sprintf to get the colors to hex. And your scaling can be drastically reduced... by default, if you say "resize to 50x50", you get a proportionate scaledown that makes the largest dimension 50 but the smaller dimension appropriate! No math required.

-- Randal L. Schwartz, Perl hacker
Be sure to read my standard disclaimer if this is a reply.

Replies are listed 'Best First'.
Re: •Re: Image2HTML
by Chady (Priest) on Mar 23, 2003 at 08:26 UTC

    The fact that I did it that way was that I was trying to do it with GD first, then realised that it's not installed on the test server, and I needed to put a live version, so I switched to Image::Magick, which is the first time I use. So $image->GetPixel($x, $y) became $image->Get("pixel[$x,$y]").

    And besides, the documentation of Image::Magick is still a bit greek to me.

    Thanks for the advice.
    He who asks will be a fool for five minutes, but he who doesn't ask will remain a fool for life.

    Chady | http://chady.net/