resampling images

resampling images

am 27.10.2007 00:00:49 von daniel

Hello,

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
places.

Any pointers, help is greatly appreciated.

Re: resampling images

am 27.10.2007 08:58:45 von Tim Roberts

Daniel wrote:
>
>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 size (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
>places.

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
limits.

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

Re: resampling images

am 27.10.2007 10:34:48 von petersprc

Hi,

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

http://imagemagick.org/script/command-line-options.php#resam ple

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

http://us.php.net/manual/en/function.imagecopyresampled.php# 77679

On Oct 26, 5:00 pm, Daniel wrote:
> Hello,
>
> 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
> places.
>
> Any pointers, help is greatly appreciated.