[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] GIF image size



On Thu, 14 May 1998,  Angus McIntyre wrote:

> JPEGs
>in particular do everything in their power to avoid revealing their
>dimensions to the casual inquirer.

Now that ain't a nice remark. Once you understand the format of JPEG's,
it's actually reasonably simple.

It consists, after two initial bytes (0xFF 0xD8) mainly of groups of
fields, of which the first byte is 0xFF, the second byte is a tag byte
(that marks the kind of field), and the third and fourth bytes form a
2-byte length integer in Big Endian order (= 2 more than the actual
length of the rest of field). The rest is custom data.

All you have to do is skip fields until you get at the one you need: the
one with the size (and color depth) info.

The Image::Size module shows you how to actually do this.

Anybody interested in TIFF files ? :-)

	Bart.

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch