#!/usr/bin/perl -Tw use strict; $|++; use CGI qw/:standard *table/; $CGI::POST_MAX = 200000; # it's already too heavy print header, start_html('Image2HTML'); print h1 ('Image2HTML'); if (param('do')) { eval "use Image::Magick"; die "We need Image::Magick: $@\n" if $@; my $image; my $file = upload('file'); $image = Image::Magick->new or die "Cannot create Image::Magick Object: $image\n"; my $error = $image->Read(file=>$file); if ($error) { print strong('Bad File: '. $error ); } else { $image->Set(magick => 'rgb') && die "Cannot set to RGB, $_"; $image->Scale(geometry => '50x50'); my $width = $image->Get('columns'); my $height = $image->Get('rows'); print start_table({-border=>0, -cellpadding=>0, -cellspacing=>0}); my @blobs = unpack "C*", $image->ImageToBlob(); for (1..$height) { print q||; for (1..$width) { print q||; } print qq|\n|; } print end_table; } } print hr; print p(q|This is Image2HTML, just another way to waste computer resources. Use the file field to upload an image (maximum size 200,000 bytes) and get it back as colored HTML <table>. Any kind of image will mostly work.|); print p(q|Note: The image is scaled down/up(?) for your own interest ;)|); print p(q|This works best with images that have smooth color changes and gradients, brisk turns in colors can come out ugly.|); print start_form('POST', CGI::url(), 'multipart/form-data'); print filefield('file'), submit('do', 'Upload'), br; print end_form, end_html;