Reducing image file sizes

J. Landman Gay jacque at hyperactivesw.com
Mon May 18 22:26:17 EDT 2009


Brian Yennie wrote:
> If you're up for the programming headaches involved, one way to deal 
> with very large images is to cut them up into tiles. For example, 
> cutting each image into 4 tiles can saving them in JPEG format can be 
> considerably smaller than the original image. I believe the 
> effectiveness would depend on your content, and of course will only work 
> in a compressed format like JPEG where each tile has a chance to be 
> optimized by the compression algorithm separately. You could potentially 
> load the tiles into a group of image objects and then manipulate the 
> whole group at once.
> 
> If this is going on a CD, can you not literally use Graphic Converter? I 
> believe it is scriptable. If you cut the resolution in half (which will 
> double the dimensions), THEN scale to 50% you should end up with the 
> original image size with half the resolution.
> 
> One last thought, you could attempt to use imageData -- skip every other 
> pixel to get "half" resolution and see how the quality turns out.

ImageData was my first thought, or exporting snapshots. Maybe if I 
explain more what this is for it will inspire some ideas.

This is for an inventory database and many of the records have multiple 
(referenced) images. The inventory data is used for insurance purposes. 
The customer base is largely computer-naive, almost all using Windows XP 
or Vista, with a smattering of OS X users.

The software works fine, it's the customers that are the problem. :) 
They are taking digital photos that weigh in at 3-4 megs apiece, and 
scanning documents even larger, and creating hundreds of images. My 
client gets complaints that the software prints too slowly, and that all 
the data won't fit on a CD.

So we decided to reduce their images for them behind their backs. The 
goal is to make the files as small as possible while retaining good 
enough quality to use for insurance claims. Marriage licenses and other 
documents have to remain legible. But of course we don't know ahead of 
time what resolution the images are at. I only know they are all jpegs.

Cutting up images would be difficult to work with in a program like 
this, and I can't use a third-party program to do the processing because 
there's no way to know what the customers have installed. So what I need 
to do (I think) is determine what that original size is, scale the image 
to be that size, and then save the imageData from that. Or so the theory 
goes.

I've been doing some googling and the specs for JPEGs say the resolution 
info is saved in the file header. If I knew the resolution I could 
calculate the original image size. I opened a few jpgs as text and 
looked at the headers but I couldn't find it in any of them. If it's in 
there, it isn't readable to me.

Maybe I should just suggest we change the program specs...unless someone 
has ideas?

-- 
Jacqueline Landman Gay         |     jacque at hyperactivesw.com
HyperActive Software           |     http://www.hyperactivesw.com



More information about the use-livecode mailing list