Reducing image file sizes
Alex Tweedly
alex at tweedly.net
Tue May 19 17:39:15 EDT 2009
J. Landman Gay wrote:
>
> Yeah. I can tinker with it. The main thing is to know what the size it
> is supposed to be when printed. That's where I'm stuck.
>
>> You said that you need to find the original size -- does Rev not open
>> high resolution images at the correct size?
>
> Not really. If the image isn't scaled or put into a locked image
> object, the image opens at its native pixel-count size, disregarding
> resolution. So if the image is thousands of pixels wide, Rev uses
> thousands of pixels to display it. A 2-inch image saved at 72 dpi will
> open at half the display size of a 2-inch image saved at 144 dpi. All
> Rev gives you is the pixel count.
>
I basically agree with the other comments - i.e. that you are stepping
into a minefield here, and should think very hard about whether you
should do so. And if you must, think about throwing up a warning
message (like "The image uses a very large amont of disk space. Here is
the recommended reduced version. lease verify that it retains enough
quality for your purposes" and display the resampled / reduced /
compressed ... etc. image).
Back to the original question ....
I think the info you need is (generally at least) in the jpg file
(Google for "EXIF data"). A while ago I wrote a library to extract the
EXIF data from jpeg / tiff files. You can find it on Revonline (for
pre-3.5 - I haven't got anything uploaded onto the new revonline yet).,
under username alextweedly, and called libEXIF - comes packaged with a
very simple test stack to ask for a jpg file and print out the exif
info. Sample output is as follows; you want the XResolution,
YResolution and ResolutionUnit values ....
> took 10
> Image ,ImageDescription,,ASCII,146
> Image ,Make,NIKON,ASCII,178
> Image ,Model,E950,ASCII,202
> Image ,Orientation,1,Short,54
> Image ,XResolution,300/1,Ratio,216
> Image ,YResolution,300/1,Ratio,224
> Image ,ResolutionUnit,Pixels/Inch,Short,90
> Image ,Software,v981p-78,ASCII,232
> Image ,DateTime,2004:10:21 14:58:39,ASCII,264
> Image ,YCbCrPositioning,2,Short,126
> Image ,ExifOffset,284,Long,138
> EXIF ,ExposureTime,1/87,Ratio,578
> EXIF ,FNumber,57/5,Ratio,586
> EXIF ,ExposureProgram,Program Normal,Short,318
> EXIF ,ISOSpeedRatings,80,Short,330
> EXIF ,ExifVersion,0210,String,342
> EXIF ,DateTimeOriginal,2004:10:21 14:58:39,ASCII,594
> EXIF ,DateTimeDigitized,2004:10:21 14:58:39,ASCII,614
> Skipping EXIF ,ComponentsConfiguration
> EXIF ,CompressedBitsPerPixel,2/1,Ratio,634
> EXIF ,ExposureBiasValue,0/1,Signed Ratio,642
> EXIF ,MaxApertureValue,13/5,Ratio,650
> EXIF ,MeteringMode,,Short,426
> EXIF ,LightSource,Unknown,Short,438
> EXIF ,Flash,No,Short,450
> EXIF ,FocalLength,102/5,Ratio,658
> Skipping EXIF ,MakerNote
> EXIF
> ,UserComment,
> ,String,666
> EXIF ,FlashPixVersion,0100,String,498
> EXIF ,ColorSpace,1,Short,510
> EXIF ,ExifImageWidth,1600,Long,522
> EXIF ,ExifImageLength,1200,Long,534
> EXIF ,InteroperabilityOffset,886,Long,546
> Skipping EXIF ,FileSource
> Skipping EXIF ,SceneType
> Thumbnail ,Compression,JPEG Compressed,Short,802
> Thumbnail ,XResolution,300/1,Ratio,870
> Thumbnail ,YResolution,300/1,Ratio,878
> Thumbnail ,ResolutionUnit,Pixels/Inch,Short,838
> Thumbnail ,JPEGInterchangeFormat,2036,Long,850
> Thumbnail ,JPEGInterchangeFormatLength,4173,Long,862
Good luck
-- Alex.
More information about the use-livecode
mailing list