resampling images

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

I was wondering if I was missing something simple, an existing
function, that allows me to resample image in size (width and height)
as well as the file size as well.

What I am trying to do is automate importing images and standardize
the saved version to a typical dimension and maximum file sie (80Kb).

I have found numerous scripts for resample the dimensions of an image
but file size seems trickier to find or I'm not looking in the right

Any pointers, help is greatly appreciated.

Re: resampling images

Quoted text here. Click to load it

What format?  The file size is determined by the width, height, and
compression factor.  Uncompressed images of a particular width and height
will always be the same size.  With compressed images, like JPEG, you can
tweak the compression quality to adjust the file size, within certain

So, basically, you should choose your dimensions so that the size is
roughly in the range you want.
Tim Roberts,
Providenza & Boekelheide, Inc.

Re: resampling images


You can use the Imagemagick convert command with -resample, -quality,
and -sampling-factor to adjust the compression. See the docs here:

For GD, you can use this nifty function that includes a quality

Quoted text here. Click to load it

Site Timeline