[Image-SIG] Setting TITT Attributes when saving

Michael Bierenfeld michael.bierenfeld at web.de
Tue Feb 22 13:37:19 CET 2005


I have just joined the list .. so nice greetings to all :

The following code :

fp = open (pgmpfile)                  # 8 Bit pgm File
imagecontent = fp.read ()
fp.close ()                       
parser = ImageFile.Parser ()
parser.feed (imagecontent)
image = parser.close ()                        
image.save (tifffile)

Stores a PGM-File as a TIFF-File. The File should be further processed by pytiff. But this packages throws the following Exception while executing

reader = pytiff.TiffReader (tifffile)

ValueError: TIFF image doesn't have a samples per pixel tag.

The same happens if I convert the Image with image = image.convert ("1")

Then it complains "ValueError: TIFF image doesn't have a bits per sample tag" too. Does anybody know how to set these parameters in the saved TIFF-File ?

More information about the Image-SIG mailing list