Help: making images with perl?

Discussion in 'Perl Misc' started by Giancarlo, Nov 27, 2004.

  1. Giancarlo

    Giancarlo Guest

    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
     
    Giancarlo, Nov 27, 2004
    #1
    1. Advertising

  2. Giancarlo

    gnari Guest

    Re: making images with perl?

    "Giancarlo" <> wrote in message
    news:...
    > [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
     
    gnari, Nov 27, 2004
    #2
    1. Advertising

  3. Giancarlo

    krakle Guest

    Re: making images with perl?

    > "Giancarlo" <> wrote in message
    > news:...
    > > [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.
     
    krakle, Nov 28, 2004
    #3
  4. Giancarlo wrote:

    > 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
     
    Gregory Toomey, Nov 28, 2004
    #4
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. dpackwood
    Replies:
    3
    Views:
    1,811
  2. Replies:
    5
    Views:
    1,878
    Andrew Thompson
    Jan 12, 2005
  3. Cogito
    Replies:
    9
    Views:
    12,402
    Cogito
    Dec 14, 2003
  4. Jan Danielsson

    Making headers honor images?

    Jan Danielsson, Jul 25, 2005, in forum: HTML
    Replies:
    8
    Views:
    408
    Jonathan N. Little
    Jul 25, 2005
  5. aak

    Making Resizable Images

    aak, Jun 1, 2007, in forum: HTML
    Replies:
    2
    Views:
    435
Loading...

Share This Page