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

Re^2: Shrink Images and PDFs

by haukex (Bishop)
on Jun 13, 2020 at 14:24 UTC ( #11118022=note: print w/replies, xml ) Need Help??


in reply to Re: Shrink Images and PDFs
in thread Shrink Images and PDFs

If convert is on your system, chances are so is Image::Magick.

Not in my experience; usually the Perl module has to be installed separately. How easy that is depends on what Perl you're using, for example, one could use the system Perl and just install libimage-magick-perl, but building ImageMagick (or GraphicsMagick nowadays, apparently) and its Perl module can be a can of worms.

Is there a reason to not use a pure Perl implementation rather than forking a convert process?

Simplicity, mostly. This was only intended for *NIX (for now), I wasn't concerned about performance, and since I'm using my own IPC::Run3::Shell module, I can be sure to avoid all the pitfalls of running external commands. Using the Perl module would be better if I was doing multiple operations on the image that are hard to do in a single command line, but the convert command line I'm using is simple enough.

Replies are listed 'Best First'.
Re^3: Shrink Images and PDFs
by perlfan (Priest) on Jun 13, 2020 at 17:28 UTC
    >usually the Perl module has to be installed separately

    Sorry, I meant that the Perl module comes with installing ImageMagick itself if you do it from source. From my experience installing it from source is straightforward (they make it so necessarily). Just a thought I wanted to mention since I've use gone down a similar route with image manipulation. I didn't do any shrinking, but added some watermarks to images I was serving. I also served up different "sizes". But it was all done via the Perl library, not convert itself. Anyway, I think your use of Perl is really neat here.

        Well, thanks for the heads up. It's been a while since I installed IM so I might have been pretty baffled if I did it again now.

        $ ./configure --with-modules --enable-shared --with-perl
        Ah well there you go.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2020-09-24 08:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    If at first I donít succeed, I Ö










    Results (132 votes). Check out past polls.

    Notices?