FCL-image, FPwritePNM can't write 16bit and FPreadPNM reads wrongly 16 bit images
Original Reporter info from Mantis: HK59 @han.k
-
Reporter name: han
Original Reporter info from Mantis: HK59 @han.k
- Reporter name: han
Description:
The package FCL-image is in general 16 bit.
Exporting via FPwritePNM is in 8 bit format only. Many software package (PhotoShop, DRRAW can write 16 bit files. Suggest to extend the PNM read and write routine to 16 bit.(RGB48 or Gray16)
Reading of a 16 bit file (.PPM .PGM) looks it is supported in the reader but the the result is wrong. I suspect the HI and LOW bytes are swapped against the semi standard (as by PhotoShop, DCRAW, ASTAP). Suggest to correct this.
And as last suggestion in the writer code is an inefficient test for dataabove 255. Suggest to provide a boolean to set 8 or 16 bit output format.
Note a 16 bit header looks like this (without comments}:
P6 {type P6}
185 {width}
272 {height}
65535 {<==16 bit}
So 65535 rather then 255.
Attached several test files.
Steps to reproduce:
Use attached 16 bit file with the reader