I need to compress images that are uploaded by users when the image file size is greater than a specific size. For example, if someone uploads a 150k file, I want to compress it so that it is 100k or less (perhaps by compressing as a JPG with a quality of 80 -- and then doing that again if the resulting file is *still* over 150k).

The problem is that Image::Magick doesn't seem to exist on CPAN anymore. It has a record but the download 404's me -- and the most recent version I can find anywhere on mirrors is *.31 (as opposed to *.39) and it won't compile.

Can anyone reccommend an alternative way to accomplish this? There will likely be 1.5 million images on the server at any one time so restricting the size is important -- and just putting an upload cap on the file size is a lesser solution as it requires extra work on the user's part to whip out an editor and figure out how to compress their images and so on.

In reply to ImageMagick alternative for compressing images? by Seumas

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.