home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!spool.mu.edu!wupost!waikato.ac.nz!ldo
- From: ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: JPEG <-> JFIF with QT.
- Message-ID: <1992Sep4.173121.10616@waikato.ac.nz>
- Date: 4 Sep 92 17:31:21 +1200
- References: <mackid-280892211810@toysrus.engin.umich.edu.>
- Followup-To: comp.sys.mac.programmer
- Organization: University of Waikato, Hamilton, New Zealand
- Lines: 39
-
- In article <mackid-280892211810@toysrus.engin.umich.edu.>, mackid@engin.umich.edu (Mike Neil) writes:
- >
- > I noticed that the Pict Viewer App that
- > comes on the QT CD was able to read and write JFIFs. So I looked at
- > it a bit more, and fould that the data portion that is returned from a
- > CompressImage call is in the JFIF format (Someone give the QT guys another
- > cookie). So basically you can read a JFIF file into memory pass it into
- > the DecompressImage call (You will need to make a Info block by hand).
- > and you will get a decompressed image out. Very Cool.
- >
- > P.S. Couldn't find any mention of this in the QT docs so my guess is
- > it is an unsupported feature.
-
- I had a read of the JFIF specs. The main thing it offers you over vanilla
- JPEG is the X and Y resolution information, which gives you some idea of what
- scale to view the image at. It is true, though, that the QuickTime JPEG
- compressor reads and writes a standard JPEG data stream (well, it would have
- to, wouldn't it?). Thus it's very easy to read and write JPEG files on a
- QuickTime-equipped Mac.
-
- Things get a little harder, though, if the image is too big to fit in memory
- all at once. Then you have to figure out how to use data loading and unloading
- routines with the Image Compression Manager...
-
- Here's one useful piece of information about the JPEG data stream, for those
- (like me) who have never seen a copy of the JPEG spec: if you want to determine
- the size of the image, look for a hex FF byte followed by a hex C0 byte. Skip
- the next three bytes, and you will find a 2-byte integer containing the number
- of lines, followed by a 2-byte integer containing the number of columns. Both
- are in big-endian format (ie on a Mac, you don't have to worry about it).
-
- Thanks to Dolf Starreveld at Storm Technology for telling me this, along with
- several other interesting things, a long time ago...
-
- Lawrence D'Oliveiro fone: +64-7-856-2889
- Computer Services Dept fax: +64-7-838-4066
- University of Waikato electric mail: ldo@waikato.ac.nz
- Hamilton, New Zealand 37^ 47' 26" S, 175^ 19' 7" E, GMT+12:00
- Ask not for whom the phone rings; it rings for you.
-