Add new comment

You ca even use existing

You ca even use existing tools instead of coding w/ libraw or libtiff, see e.g. (and then easily convert PGM to TIFF w/ pamtotiff), or you can also use ImageMagick/GraphicsMagick and define the 'gray' input:

convert -size 512x512 -depth 16 -endian LSB gray:original.bayer -type grayscale result.tif (of course change the dimensions and endianness to suit your need)