Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Dynamic image collages delivered by webserver

by fgsfds100 (Initiate)
on Aug 28, 2012 at 02:05 UTC ( #990111=perlquestion: print w/ replies, xml ) Need Help??
fgsfds100 has asked for the wisdom of the Perl Monks concerning the following question:

Are Image::Magick and/or GD compatible with Perl v5.10.0?

Is it possible to build dynamic images, specifically out of other resized images resulting in a collage, that can be delivered via webserver?

A "Hello World" picture, if you will.

Here is an example of the type of thing I want to eventually make. NO I'M NOT LOOKING FOR SOMEONE TO CODE THIS SPECIFICALLY.

http://card.psnprofiles.com/1/someone01.png

I've heard about things like Image::Magick and GD, but as with all modules and things, I'm never really sure which ones will work for me or how I'm supposed to install them. I've tried downloading various different archive files and sticking the PM files into perl/bin and I've tried various different installers but I can never get any of it to work because the instructions aren't clear enough. I'm using Windows XP SP2, an apache 2.2 webserver and perl v5.10.0

Also it would be nice to see some sample code that can do the basics: generate an image of a particular size, with some background color or image, insert an existing image, insert some random text in some random color, and maybe draw a line or shape or something (much less important). All in particular positions, sizes and opacity.

I just need something to get me started. All the stuff I've found on google has been a bit too generalized, ambiguous and over my head.

------------------------ EDIT ------------------------

This is what brief, concise help might look like.

- Hey dude, I think this module would be better for you
- download it here (direct link or link to site and specify which version I should get, ie: is compatible and has all the basics of point 2...)
- run the installer -- or -- put the files here and type this in the command prompt to compile it
- here's a quick sample set of basic functions

use blah; $img = new image; $img -> insertImage(paramenters); $img -> changeColor(paramenters); $img -> insertText(paramenters); $img -> changeColor(paramenters); $img -> insertLine(paramenters); binmode; # necessary ??? print $img;

Then when someone goes to site.com/cgi/hello.pl, it generates something for them.

Comment on Dynamic image collages delivered by webserver
Download Code
Reaped: Re: Dynamic image collages delivered by webserver
by NodeReaper (Curate) on Aug 28, 2012 at 02:31 UTC
      Um... okay that's helpful... mind telling me why? Is it my setup or are you just trying to be a dick?

        Um... okay that's helpful... mind telling me why? Is it my setup or are you just trying to be a dick?

        You ask Is it possible to build dynamic images, specifically out of other resized images resulting in a collage, that can be delivered via webserver? but you know the answer, of course its possible

        Then you go on to say you've heard how you might accomplish thing but its all a bit too generalized, ambiguous and over my head.

        Sorry guy, you're a lost cause

Re: Dynamic image collages delivered by webserver
by Mr. Muskrat (Abbot) on Aug 28, 2012 at 03:53 UTC

    This isn't a code writing service. You have to show some effort or you will not get good responses.

    You should start by reading the docs for GD and Image::Magick. Study and try out all of the demos and test cases (they both include those). Search this site for posts about those modules and learn more about them. Then when you've done all of that, you should be in a position to write the script you want. If it doesn't work, you can make a new post that not only tells what is and isn't working but also shows the code so that we can help you with it.

      I'm not looking for a code writing service. What is it with you people? Where do you get this belief that people like me are looking for a polished script?

      I'm not asking for the moon here. I'm only asking for two things.

      .

      1. A suggestion of which module you think would be better suited for my goal and a concise tutorial on how to install them.

      -- One that provides a WORKING link to a WORKING (Perl v5.10 compatible) installer, pm file or archive file, and explains exactly how to install it if it isn't already an wrapped in an installer itself.......... rather than the usual "tutorial by bibliography" list of (often dead) links a la "you might find it here or here or here or here, and tips on how to install it here or here or here or here." --

      - Hey dude, I think this module would be better for you
      - download it here (direct link or link to site and specify which version I should get, ie: is compatible and has all the basics of point 2...)
      - run the installer -- or -- put the files here and type this

      .

      2. Basic functions that I can play with. To build an image consisting of smaller images and colored text and lines.

      use blah; $img = new image; $img -> insertImage(paramenters); $img -> changeColor(paramenters); $img -> insertText(paramenters); $img -> changeColor(paramenters); $img -> insertLine(paramenters);

      A "Hello World" picture, if you will. That's all I'm after. Is that so hard?

      If you just plain don't know but don't want to come right out and say it, that's fine to. Just don't reply.

        That's all I'm after. Is that so hard?

        Each one of the modules you mentioned comes with all those things, instructions on how to install, hundreds of examples.

Re: Dynamic image collages delivered by webserver
by Corion (Pope) on Aug 28, 2012 at 06:32 UTC
    If you are looking for good/saner alternatives to ImageMagick and GD, maybe consider looking at Imager. It provides a smaller featureset than ImageMagick, but with a saner and more stable API. I won't post any code, as the documentation is quite extensive.
Re: Dynamic image collages delivered by webserver
by Anonymous Monk on Aug 28, 2012 at 07:00 UTC
Re: Dynamic image collages delivered by webserver
by aitap (Deacon) on Aug 28, 2012 at 09:40 UTC
    I've tried downloading various different archive files and sticking the PM files into perl/bin and I've tried various different installers but I can never get any of it to work because the instructions aren't clear enough.
    Did you try cpan? (or ppm if you use Active Perl)? (BTW, you didn't state which Perl do you actually use. There are many Perl builds for Windows with different abilities)
    - Hey dude, I think this module would be better for you
    GD and Image::Magick are good enough.
    - download it here (direct link or link to site and specify which version I should get, ie: is compatible and has all the basics of point 2...)
    Both of them can be downloaded via cpan.
    - run the installer -- or -- put the files here and type this in the command prompt to compile it
    cpan will install them, too.
    - here's a quick sample set of basic functions
    Here you are: GD Image::Magick
    Sorry if my advice was wrong.
Re: Dynamic image collages delivered by webserver
by zentara (Archbishop) on Aug 28, 2012 at 10:09 UTC
Re: Dynamic image collages delivered by webserver
by philiprbrenan (Monk) on Aug 28, 2012 at 12:07 UTC

    Both ImageMagick and GD are compatible with perl 5.10.

    If you have ImageMagick installed on your system you can run it like this:

    my $imageMagick = "C:/Phil/ImageMagick-6.7.3-Q16/convert.exe"; + # Convert images say for qx($imageMagick \"$source\" -resize x$Y $\"target\");

    You can find extensive documentation at: http://www.imagemagick.org/script/command-line-options.php

    GD is also excellent. You might try GD::Simple first.

    I would suggest you spend time initially with ImageMagick due to its very broad applicability, deep documentation base, and exhaustive list of examples, and then move to GD in the (unlikely) event that you cannot find a solution to a specific problem.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://990111]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (7)
As of 2014-09-24 01:27 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (244 votes), past polls