JPEG - Resize Image to filesize?

Soldato
Joined
18 Oct 2002
Posts
16,030
Location
The land of milk & beans
'Noon all.

I'm currently creating an image gallery system where someone uploads a high-res image and they system automatically makes a mid and low res version of it.

The problem I have is that the each res (high-mid-low) is set by the user. So mid res images could be 5Mb for one user, and 500Kb for another.

Is there any algorithm to determine the filesize from the resolution of the image.

E.g. If i wanted a 750k image, I'd resize to X by Y px?

btw. The images to be dealt with are JPG, GIF, PNG and TIFF

TIA

*edit - i meant to put ASP, not JPEG in the thread title :doh:*
 
Last edited:
thanks for the reply whitecrook. I though compression would be a factor in the calculations, but couldn't think of a bullet proof way of taking it into account.

I think because of the timescales involved with this project, the high/mid/low res's will have to be set on an image width/height basis rather than filesize which will make the resizing process far quicker and simpler.
 
Back
Top Bottom