2002.07.23 22:50 "CCITT Group 4 assistence needed for HylaFAX", by Lee Howard

2002.07.24 12:51 "Re: CCITT Group 4 assistence needed for HylaFAX", by Frank D. Cringle

If you really need to count the lines in a G4 image, you need to know the precise width and then run through all the data, interpreting each code bitstring as you go.

The image width is known because it is part of the negotiated session parameters, but I don't particularly feel like writing a G4 decoder (but - see below - that may be unavoidable) :-)

No need to write one, there is one in libtiff.

As to adding or replacing initial lines, the easiest way would be to expand the image into a bitmap, replace the lines and then re-encode the image.

By expanding the image into a bitmap I presume you mean via an external tool.

Well, I was assuming that libtiff is linked in to your application. If all you have are the raw G4 data, you need to fake up some data structures before calling the decode routines in libtiff. At least I assume that would be possible. Then libtiff gives you the image in the form of lines of pixels.

For portability purposes and sanity, I'm not sure this is an ideal option - but, following this approach, we could convert it to G3, use the existing mechanism to image the tagline, and then convert it back to G4. But... as I said, this isn't ideal.

Doing it more efficiently by just replacing the relevant part of the raw data should be possible but rather fiddly.

Any more fiddly than with G3? We're already editing raw data with G3.

Simple G3 (one-d encoded, lines padded to byte boundaries) is easier because because you can detach and attach lines without interaction with the remaining lines.

Frank Cringle,      fdc@cliwe.ping.de
voice: (+49 7745) 928759; fax: 928761