home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!cs.utexas.edu!zaphod.mps.ohio-state.edu!rpi!usenet.coe.montana.edu!news.u.washington.edu!ogicse!das-news.harvard.edu!cantaloupe.srv.cs.cmu.edu!tgl
- From: tgl+@cs.cmu.edu (Tom Lane)
- Newsgroups: comp.sys.mac.programmer
- Subject: Re: JPEG <-> JFIF with QT.
- Message-ID: <BuI2pL.92z.2@cs.cmu.edu>
- Date: 13 Sep 92 04:48:56 GMT
- Article-I.D.: cs.BuI2pL.92z.2
- References: <mackid-280892211810@toysrus.engin.umich.edu.> <1992Sep4.173121.10616@waikato.ac.nz>
- Sender: news@cs.cmu.edu (Usenet News System)
- Organization: School of Computer Science, Carnegie Mellon
- Lines: 41
- Nntp-Posting-Host: g.gp.cs.cmu.edu
-
- (Sorry for the slow response ... don't read this group often.)
-
- mackid@engin.umich.edu (Mike Neil) says:
- > 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.
-
- I don't recall offhand whether QT makes a true JFIF file (complete with JFIF
- marker) or just a "raw JPEG" file. Either way, though, the information is
- compatible with non-Mac JFIF/JPEG programs. The JFIF marker is considered
- optional by most non-Mac decoders; it really just certifies that the file
- adheres to the JFIF conventions about colorspace.
-
- > Couldn't find any mention of this in the QT docs so my guess is
- > it is an unsupported feature.
-
- I think it's reasonably safe to rely on it --- Apple's chief JPEG engineer
- has spent a good deal of time making sure QT is compatible with JFIF-based
- decoders :-)
-
- And ldo@waikato.ac.nz (Lawrence D'Oliveiro, Waikato University) writes:
- > 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.
-
- Bzzt. Sorry, but that method is guaranteed to break sooner or later. If
- you want reliable info, you have to parse the JPEG marker sequence, at least
- well enough to skip over the arbitrary data that may be inside marker bodies
- preceding the SOF marker.
-
- If you don't want to buy a copy of the JPEG standard, at least go read the
- free JPEG code available from ftp.uu.net: graphics/jpeg/ ... in particular,
- jrdjfif.c will show you how to do this right. It only takes a few more
- lines of code.
-
- regards, tom lane
-