Re: Using Imager module to resample images



On Tue, 29 Jan 2008 03:08:11 -0800 (PST), Jason Carlton
<jwcarlton@xxxxxxxxx> wrote:

I've been forcing my visitors to resample their images manually to
keep them below 50kb, but this has only had so-so results. A lot of my
visitors don't understand how to resample their image, so I'm getting
high-resolution images that are something like 20px x 20px, but still
take up 50kb!

So, I've been thinking about resampling the images on the fly. The
images would be restricted to JPG, JPEG, GIF, and PNG.

I was planning to use a combination of Image::Resize and Imager, which
I've never used before, but since the load on the server is ALWAYS
high, I had a few questions first:

1. Will the use of Imager take up a lot of CPU resources?

Never noticed an excessive cpu usage, but check it yourself.

2. How do I recognize an animated GIF from a static GIF?

I believe it's safe to assume a static gif begins with GIF87, and
an animated with GIF89. But I'm not sure it's an absolute.

3. Does Imager compress JPG images automatically? I didn't see an
option to set a compression level in the docs, but it may be called
something else that I'm not recognizing.

4. I assume that I'll need to use Image::Resize to get the current
width and height, and if it exceeds the maximum that I input then I'll
use Imager to resample it. Is there a smarter (read: simpler and/or
less resource-heavy) option that this?

Your best bet is to read
perldoc Imager::Files for the jpegquality parameter
perldoc Imager::Transformations for converting and scaling
perldoc Imager::ImageTypes
perldoc Imager will give an overview

Also http://groups.google.com will have many examples.
Search for things like:
"perl Imager resize", etc

zentara


Jason

--
I'm not really a human, but I play one on earth.
http://zentara.net/japh.html
.



Relevant Pages

  • Using Imager module to resample images
    ... I've been forcing my visitors to resample their images manually to ... Will the use of Imager take up a lot of CPU resources? ... How do I recognize an animated GIF from a static GIF? ...
    (comp.lang.perl.misc)
  • image resampling using IPT
    ... I have some medical images with pixel dimensions of say 1x1x5.5 mm ... transform and then resample them using the image processing toolbox ... array index as a coordinate and this is giving me some problems. ... dimension weighted differently to the x,y dimension when resampling is ...
    (comp.soft-sys.matlab)
  • Re: Image resampling in PPT?
    ... In the future, be sure to have the marketing people, resample the images ... When resampling images it is important change the resolution first, ... into powerpoint via (insert> pictures> from ...
    (microsoft.public.powerpoint)
  • Linux based TIFF resampling
    ... resample TIFF images to a different resolution... ... paper size from 18x24 inches to 36x48 inches or larger, ... from originals at 400 dpi. ...
    (comp.graphics.misc)
  • Re: Back to basics: Interpolation teaser
    ... On Sep 22, 1:10 pm, Martin Leese ... on the resample circle image, the circle profile displays some 'saw ... The interpolated images contain only black ...
    (sci.image.processing)