Help: making images with perl?

G

Giancarlo

Hello,

I am able to program a little bit in perl and I can write cgi's that
make HTML pages whose content depend on the inputs of the visitors.
But that's all what I am able to do: I am not expert at all.

At this time I need to write a perl cgi that makes simple geometrical
images (they are very simple and may be black/white). I wonder how I
can do this in perl.
Actually I am able to do this in a very stupid way, that is: I have a
1 pixel white bmp file, and a 1 pixel black bmp file, and then I run a
perl cgi that makes a HTML page (!) placing side by side these images,
depending on the figure I need to build. For example:
<img src = white.bmp><img src = black.bmp><img src = white.bmp><img
src = white.bmp> and so on... and <br> at the end of the first row of
pixels.
Actually it works: the real imagine appears into the browser! It is
made of thousands of 1-pixel bmp files (white.bmp and black.bmp) that
are placed side by side.
I understand that this is a stupid way, but I am not able to do better
than this, due to my ignorance.

Can I do something better, provided that I can't study very much about
this matter? Is perl useful to do this, or should I use javascript?
But I don't know anything about it... Or even java? (I hope not).

Thanks for any suggestion (please write in a simple way, I don't know
perl very well).

Giancarlo
 
G

gnari

Giancarlo said:
[asks how to do graphics with cgi]

first look at the modules that are available on cpan.
when you have chosen the one you want, download it and install it
along with any libraries in may need.

a common method is to point your <img> src attribute to a cgi script
that produces the image.

gnari
 
K

krakle

Giancarlo said:
[asks how to do graphics with cgi]

GD (Generic but for some gets the job done nicely).

Image Magick - Powerful graphics library.

Gimp - ditto.

My favorite is Image::Magick. It can be installed from CPAN or PPM.
 
G

Gregory Toomey

Giancarlo said:
Hello,

I am able to program a little bit in perl and I can write cgi's that
make HTML pages whose content depend on the inputs of the visitors.
But that's all what I am able to do: I am not expert at all.

At this time I need to write a perl cgi that makes simple geometrical
images (they are very simple and may be black/white). I wonder how I
can do this in perl.
Actually I am able to do this in a very stupid way, that is: I have a
1 pixel white bmp file, and a 1 pixel black bmp file, and then I run a
perl cgi that makes a HTML page (!) placing side by side these images,
depending on the figure I need to build. For example:
<img src = white.bmp><img src = black.bmp><img src = white.bmp><img
src = white.bmp> and so on... and <br> at the end of the first row of
pixels.
Actually it works: the real imagine appears into the browser! It is
made of thousands of 1-pixel bmp files (white.bmp and black.bmp) that
are placed side by side.
I understand that this is a stupid way, but I am not able to do better
than this, due to my ignorance.


Use the GD module (easy), or possibly ImageMagick (harder).
http://stein.cshl.org/WWW/software/GD/

gtoomey
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top