By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,116 Members | 1,509 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,116 IT Pros & Developers. It's quick & easy.

Optimize to file size (image)

P: n/a
Photoshop has a function called optimize to file size which tries to fit an
image to some given file size. Because I need to make sure no images on a
site I'm working on are larger than X KB I need something similar so that
users don't have to worry so much about image file size. Does anyone know
of a way to do this, preferably using ImageMagick or GD?

Doing several calls to ImageMagick with different optimize settings is a not
a good option.

André Nęss
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
On Tue, 25 Nov 2003 13:52:01 +0000, André Nęss
<an*********************@ifi.uio.no> wrote:
Photoshop has a function called optimize to file size which tries to fit an
image to some given file size. Because I need to make sure no images on a
site I'm working on are larger than X KB I need something similar so that
users don't have to worry so much about image file size. Does anyone know
of a way to do this, preferably using ImageMagick or GD?

Doing several calls to ImageMagick with different optimize settings is a not
a good option.


I don't think there's any other alternative; there's no way of determining how
well an arbitrary image will compress without doing at least most of the work
of compressing it.

--
Andy Hassall (an**@andyh.co.uk) icq(5747695) (http://www.andyh.co.uk)
Space: disk usage analysis tool (http://www.andyhsoftware.co.uk/space)
Jul 17 '05 #2

P: n/a
Andy Hassall:
On Tue, 25 Nov 2003 13:52:01 +0000, André Nęss
<an*********************@ifi.uio.no> wrote:
Photoshop has a function called optimize to file size which tries to fit
an image to some given file size. Because I need to make sure no images on
a site I'm working on are larger than X KB I need something similar so
that users don't have to worry so much about image file size. Does anyone
know of a way to do this, preferably using ImageMagick or GD?

Doing several calls to ImageMagick with different optimize settings is a
not a good option.


I don't think there's any other alternative; there's no way of
determining how
well an arbitrary image will compress without doing at least most of the
work of compressing it.


Yeah I ended up definining a max width and height and forcing all images
into 60% jpeg. This keeps me well within the limits. I'm sure there is an
upper bound on how large a jpeg image can become if you know the max
dimension, but I didn't bother to check.

André Nęss
Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.