Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

image processing using perl

by user2000 (Sexton)
on Aug 25, 2007 at 04:07 UTC ( [id://635016]=perlquestion: print w/replies, xml ) Need Help??

user2000 has asked for the wisdom of the Perl Monks concerning the following question:

Dear monks! Firstly I would like to thank the entire community for all the help they have offered me. I have the following query: Is there anyway to process an image (create thumbnail of the image etc.) in Perl without using any extra modules like Image::Magick or GD. I am trying to make a thumbnail for image (with jpeg compression). Thank you, Anant

Replies are listed 'Best First'.
Re: image processing using perl
by BrowserUk (Patriarch) on Aug 25, 2007 at 04:28 UTC

    It could be done, but here are a couple of reasons why you won't want to.

    1. It would require you to find, read and understand the jpg file format, plus all it's many variations.
    2. It would be horribly slow. (I mean it. Really, really, really slow!)

    So now the standard question: why would you want to not use the available modules?


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.
Re: image processing using perl
by perrin (Chancellor) on Aug 25, 2007 at 05:46 UTC
    I suggest you use Imager. With any of these modules, you should be able to install them without root, if there is a compiler on your machine. You will need to put the C libs in your local directory and tell the module where to find them when you compile it. If your host doesn't even have a compiler, you need to get a new host. Virtual servers with root are cheap these days, so it's hardly worth the effort fighting with bad hosting services.
Re: image processing using perl
by GrandFather (Saint) on Aug 25, 2007 at 04:33 UTC

    Image manipulation generally requires quite a bit of processing so, although such things could be done in pure Perl, it would be very slow and would probably use memory very inefficiently (which worsens performance markedly). In any case, such code would be fairly large so even if it were pure Perl, it would still be in a module. Really, for any non-trivial task, asking for a solution that doesn't use "extra" modules has a single likely answer: "No can do.".


    DWIM is Perl's answer to Gödel
    A reply falls below the community's threshold of quality. You may see it by logging in.
Re: image processing using perl
by andyford (Curate) on Aug 25, 2007 at 14:16 UTC

    This is probably obvious, but just in case you didn't think of it, I will mention an unrecommended but simple solution.

    If you want to avoid the hard work and your needs are simple, you could just call external commands with backticks and/or system, etc.

    I don't generally recommend this kind of shortcut, but it may appropriate in certain cases.

    If you're on a Unix host, look at the documentation for "mogrify".

    non-Perl: Andy Ford

Re: image processing using perl
by lyklev (Pilgrim) on Aug 25, 2007 at 21:42 UTC
    If your webhoster has the Imagemagick binaries installed, you could try to run the commands manually. Which in this case would be "convert". With a few options (see the manual page or the Imagemagick website) and one command, you can make a thumbnail.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others surveying the Monastery: (2)
As of 2024-04-20 06:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found