2007.07.11 15:13 "[Tiff] how to handle pixel vs. byte-boundary", by Oliver Geisen

2007.07.12 07:24 "Re: [Tiff] how to handle pixel vs. byte-boundary", by Oliver Geisen

Hello Bob,

It does not seem to me that you need to shift any bytes into a new position, but you will need to decode starting with the byte where the first

No, i think it's neccessary. Imagine the following scenario:

background: 100x100 Pixel
image to place: 15x20 pixel
x,y pos to place image on background: 10,10

So i have for image:

Bit: 123456781234567
Pix: XX.X.X.X.X.X.XX

Now image the background:

Bit: 12345678123456781234567812345678...


Now place image on background. This should result in: Bit: 12345678123456781234567812345678...

Pix: .........XX.X.X.X.X.X.XX...........

But how to do? look at the first byte (byte-boundaries drawn as pipes "|"):

Byte:      1        2       3        4

Bit:  |12345678|12345678|12345678|12345678|...
Pix:  |........|.XX.X.X.|X.X.X.XX|........|...

So you can see that in byte 2 the first pixel of the image to be placed is not in the first bit, so one must shift the first byte of the image by one bit to the right. In consequence each following byte in the image must also be shiftet. Each shift requires that the bits falling "out" to the left or right must be "inserted" to the following/preceeding byte. I don't know how to handle this.

I hope this figures out clear now.

Oliver Geisen
Kreisboten Verlag Mühlfellner KG
82362 Weilheim i. Ob.
Tel. 0881/686-904
Fax 0881/686-74
Sitz Weilheim, AG München, HRA 64016, p.h.G.:
Kreisboten-Verlag Verwaltungsgesellschaft mbH,
Weilheim, AG München, HRB 119773,
Geschäftsführer: Dr. Dirk Ippen, Dr. Gerd Waldenmaier