2
votes

I'm new to image processing. I just wanted to get a tiff image from raw format(NEF). I used rawpy module to get the desired output, yet the tiff image is RGB with 4 channels. I couldn't know why there is a fourth channel in the new image?

Can anyone please explain to me what is going on, and how I can get tiff image with three RGB channels?

import rawpy
import matplotlib.pylab as plt


raw_image = "DSC_0001.NEF"

raw = rawpy.imread(raw_image)
rgb = raw.postprocess()
plt.imsave("new.tiff", rgb )

image = plt.imread("new.tiff")

print(image.shape)

The array shape is : (2868, 4310, 4) !

1

1 Answers

3
votes

Finally I found the reason:

plt.imsave saves the image in RGBA , while I can use skim age.io.imsave and it will save it as RGB.

Source: Github Issue entry