joeatwork / python-lzw

LZW compression in pure python
MIT License
46 stars 17 forks source link

Adding an example for TIFF stripe compression #1

Open molnarg opened 10 years ago

molnarg commented 10 years ago

I'm using this library for TIFF manipulation. However, the first thing I was faced is this exception, when trying to decode a TIFF stripe using the simple method outlined in the README:

End of information code not supported directly by this Decoder.

It is not clear that the end of the compressed block is normally signalled by this Exception, or there is some problem with the TIFF image.

Then, when I'm compressing stripes with the method mentioned in the README, I get a lot of error messages like this when vieweing the file with Eye of GNOME:

LZWDecode: Corrupted LZW table at scanline X.

Should I use the simple lzw.compress()/lzw.decompress() method when dealing with TIFF stripes, or some other method?

It is possible that I'm messing up something else, just wanted to be sure that this is the way to go when working with TIFF stripes. Also, if this is not the right way to deal with stripes, it would be great to have a few words about it in the README.

Anyway, this library looks great, and I'm looking forward to using it :)

joeatwork commented 10 years ago

Glad to hear you're using it! If its ok, I'd love to see some of the code you're using (particularly where you get the "End of information code..." message), and see if I can build a test case out of it.