[PyQt] creating TIFF with CCITT FAX group 4 compression

Glenn Linderman v+pyqt at g.nevcal.com
Wed Jul 16 04:46:02 BST 2008

So I generate a QImage with a B&W (bitonal) image, using PyQt.

Writing it out produces a full-color 32bpp uncompressed TIFF file.  Ick.

QImage doesn't seem to know how to produce other variations.  So I wrote it into a QByteArray per the docs, and extracted the data().

Found PIL, but PIL writes only uncompressed TIFF files too, according to its documentation.

Found pytiff, can't figure out if it can write compressed TIFF files or not, nor how to make it read a TIFF from a string in memory, as it takes a filename, rather than a file() object as a parameter.

I'm pretty far down the list of Google hits, so thought maybe it was time to ask if anyone has figured out how to write out a QImage into a TIFF file along with using CCITT FAX group 4 compression.


More information about the PyQt mailing list