AWARE SYSTEMS
TIFF and LibTiff Mail List Archive

Thread

2007.08.07 14:41 "[Tiff] Indexed Images", by Christian Henning
2007.08.07 03:46 "[Tiff] bilevel image scrambling when size not divisible by 8", by Lee Cooper
2007.08.07 05:02 "Re: [Tiff] bilevel image scrambling when size not divisible by 8", by Bob Friesenhahn
2007.08.07 14:48 "Re: [Tiff] Indexed Images", by Toby Thain
2007.08.07 14:57 "Re: [Tiff] Indexed Images", by Christian Henning
2007.09.27 13:13 "Re: [Tiff] TIFF for windows...", by Edward Lam
2007.09.27 06:57 "[Tiff] TIFF for windows...", by mrinal
2007.09.27 09:36 "Re: [Tiff] TIFF for windows...", by Edward Lam
2007.09.27 13:03 "Re: [Tiff] TIFF for windows...", by DB Karron
2007.08.07 15:23 "Re: [Tiff] Indexed Images", by Frank Warmerdam
2007.08.07 15:27 "[Tiff] Indexed Images - part 2", by Christian Henning
2007.08.07 15:31 "[Tiff] Re: Indexed Images - part 2", by Christian Henning
2007.08.07 15:41 "Re: [Tiff] Indexed Images", by Toby Thain
2007.08.13 22:43 "[Tiff] 16-bit palette image", by Christian Henning
2007.08.16 07:15 "Re: [Tiff] 16-bit palette image", by Reinhard Mayr aka Czerwinski
2007.08.17 19:00 "[Tiff] How to write a planar tiff file", by Christian Henning
2007.08.17 19:03 "Re: [Tiff] How to write a planar tiff file", by Toby Thain
2007.08.17 19:10 "[Tiff] How to write a planar tiff file", by Christian Henning
2007.08.17 19:57 "Re: [Tiff] How to write a planar tiff file", by Kai-Uwe Behrmann

2007.08.07 05:02 "Re: [Tiff] bilevel image scrambling when size not divisible by 8", by Bob Friesenhahn

On Mon, 6 Aug 2007, Lee Cooper wrote:

Apparently I have some misunderstanding about how bilevel images are handled in TIFF but I can't find much info on the subject. When the number of pixels isn't a multiple of eight how is the remainder of the byte handled? I feel like this will probably be a simple answer but I'm stuck and really need to make some progress. I've included some code snippets below.

The problem you are encountering is that a strip is just a collection of rows (see description of compression tag 259, value 1 on page 17 of the specification) and each row is padded to the next byte boundary. This means that each row is split to a new byte, and any unused bits in the last byte of the scanline should be set to zero.

Your algorithm is nice and compact but it lacks knowledge of rows.

In order to save some effort, you might consider using the TIFFWriteScanline() interface instead. It performs well and is row based.

Bob
======================================
Bob Friesenhahn
bfriesen@simple.dallas.tx.us, http://www.simplesystems.org/users/bfriesen/
GraphicsMagick Maintainer, http://www.GraphicsMagick.org/