AWARE [SYSTEMS] Imaging expertise for the Delphi developer
AWare Systems, Imaging expertise for the Delphi developer, Home TIFF and LibTiff Mailing List Archive

LibTiff Mailing List

TIFF and LibTiff Mailing List Archive
August 2007

Previous Thread
Next Thread

Previous by Thread
Next by Thread

Previous by Date
Next by Date

Contact

The TIFF Mailing List Homepage
This list is run by Frank Warmerdam
Archive maintained by AWare Systems



Valid HTML 4.01!



Thread

2007.08.07 03:46 "bilevel image scrambling when size not divisible by 8", by Lee Cooper
2007.08.07 05:02 "Re: bilevel image scrambling when size not divisible by 8", by Bob Friesenhahn

2007.08.07 05:02 "Re: 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/