From: Tim Hunter Date: 2008-02-04T11:09:00+09:00 Subject: Re: Resizing pictures for file size Marcin Raczkowski wrote: >> There is no method in RMagick that takes an image and a file size in >> bytes and returns an image that, when saved to a file, produces a file >> close to or no larger than the specified size. The file size depends >> on the image format, the compression level, and the image itself. > > There are tools that can estaminate size of file after compresion - but > they'll never give you exact size without actual compression. > > So .. you take script, 20-30 simple images, take each one, start with > some quality - and incrementally decrase untill size fits, then you take > mean and min from qualities. > > now you have 2 qualities - one that 50% of images should fit with size - > and second that almost all should fit. > > that's assuming that your surce images have simillar resolutions. > > greets > Sounds like a plan. Maybe the OP will adopt it if he can't find a library that will do what he wants automatically. -- RMagick: http://rmagick.rubyforge.org/ RMagick 2: http://rmagick.rubyforge.org/rmagick2.html