home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / sys / mac / programm / 14984 < prev    next >
Encoding:
Internet Message Format  |  1992-09-03  |  2.6 KB

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