home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #31 / NN_1992_31.iso / spool / comp / compress / 4290 < prev    next >
Encoding:
Internet Message Format  |  1993-01-01  |  3.8 KB

  1. Xref: sparky comp.compression:4290 comp.dcom.fax:2358 comp.graphics:13306
  2. Newsgroups: comp.compression,comp.dcom.fax,comp.graphics
  3. Path: sparky!uunet!gatech!usenet.ins.cwru.edu!agate!spool.mu.edu!umn.edu!csus.edu!netcom.com!jgro
  4. From: jgro@netcom.com (Jeremy G)
  5. Subject: Re: I want specs for CCITT group 4 Fax
  6. Message-ID: <1993Jan1.234038.21955@netcom.com>
  7. Organization: Not that I'm aware of :-)
  8. References: <freek.725838286@groucho.phil.ruu.nl> <C05zrt.Gz3@knot.ccs.queensu.ca>
  9. Date: Fri, 1 Jan 1993 23:40:38 GMT
  10. Lines: 76
  11.  
  12. In article <C05zrt.Gz3@knot.ccs.queensu.ca> hausner@qucis.queensu.ca (Alejo Hausner) writes:
  13. >In article <freek.725838286@groucho.phil.ruu.nl> freek@phil.ruu.nl (Freek Wiedijk) writes:
  14. >>Subject says it all.  It is question 18 in the FAQ of
  15. >>comp.compression.
  16. >>
  17. >
  18. >As I understand it, CCITT Group 4 is a method for compressing
  19. >pixelized black-and-white images.  I'll give the basic ideas, and
  20. >append some references.
  21. >
  22. >Most b/w images have have groups of adjacent pixels which are the
  23. >same colour.  Thus scanning the image row by row from top to
  24. >bottom produces sequences of identical pixels, or "runs".  There
  25. >will be a run of black pixels, then a whole run of white one,
  26. >then black, etc.  Considerable compression is achieved by
  27. >run-length encoding.  This means that instead of sending every
  28. >pixel, we send the length of each run, and the colour of the
  29. >pixels in the run.  Thus
  30. >
  31. >   wwwbbwwwbbbbbwww
  32. >
  33. >becomes
  34. >
  35. >   3w2b3w5b3w
  36. >
  37. >Further compression is possible by noting that runs alternate, so
  38. >that the colour of the pixels can be inferred from the context.
  39. >As long as we agree that the first run will be white, we just
  40. >need to send the numbers
  41. >
  42. >   3,2,3,5,3
  43. >
  44. >to convey the same information.  If the first run is black, we
  45. >stick a 0-length white run to keep things clear.
  46. >
  47. >A final step involves using Huffman codes to further compress the
  48. >number of bits sent.  For example, printed text will have a lot
  49. >of parts where the pixel rows cross the vertical bits of letters.
  50. >In those places, there will be runs of 2 or 3 black pixels.  By
  51. >using short codes to send those run lengths and longer codes for
  52. >others, Huffman coding saves transmission (or storage) time.
  53. >
  54. >Hope that helps.
  55. >
  56.  
  57.  
  58. Please note that this does not describe "Group 4" compression.  This
  59. is an excellent description of the standard "uncompressed" (or 1
  60. dimensionally compressed) fax encoding, also known as run-length
  61. encoding.  Group 4, however, takes this another step.
  62.  
  63. Briefly, Group 4 compression starts with the frist line encoded as
  64. described above.  Then the next line is described relative to the
  65. first line.  Each color transition is described as being so many
  66. pixels to the left or right of the transition in the line above it.
  67. The huffman code for "same place as the line above" is one bit, and
  68. that code occurs *very* frequently (about 50% of the transitions in
  69. the few images I have actually measured).  There are special cases for
  70. dropping or adding transitions, and if the transitions move more than
  71. 3 pixels to the left or right, Group 4 switches back to run-length
  72. encoding. 
  73.  
  74. Group 4 is the ISO standard for compressing Black and White bitmapped
  75. images, although in the worst case, the "compressed" image could be
  76. substantially larger than the uncompressed image (about 3 times the
  77. original size, by my estimation).
  78.  
  79. You can buy the CCITT spec from Global Engineering Documents, but it
  80. is expensive, as you have to by a whole volume of CCITT standards.
  81. You need CCITT Volume VII, Fasicle VII.3 Recommendations T.0-T.63,
  82. which I think goes for something like $175.  In particular, you need
  83. Recommendation T.6, which is the Group 4 compression standard.
  84.  
  85. -- 
  86. Jeremy G                    Committed to developing user-friendly products,
  87. jgro@netcom.com             Because technology is supposed to make life easier
  88.