RAW to grayscale

Image icon blocky.png17.01 KB

I'm new to image processing.

I want to decode a raw image to produce a pgm file that has merged the 4 Bayer photosites with no pre-processing (like color balance, gamma, etc.) into a 16-bit grayscale pixel.

My first attempt was dcraw -4 -D which resulted in an image, but with the characteristic "blockiness" due to the unmerged photosites.

I know Libraw is based on dcraw code, so I thought I'd ask here if anyone has any suggestions on how to use dcraw in the above scenario.