Reputation: 11
I am using a sample NEF and expecting a 4288×2848 image, but get 160x120 with the code below. Is this as expected in that PIL doesn't support NEF?
from PIL import Image
image="./blah.nef"
im=Image.open(image)
im.size
Upvotes: 1
Views: 6513
Reputation: 207465
I know the question's old, but you can use rawpy
nowadays:
#!/usr/bin/env python3
import rawpy
import imageio
with rawpy.imread('blah.nef') as raw:
rgb = raw.postprocess(gamma=(1,1), no_auto_bright=True, output_bps=16)
# Extract individual bands for fun
R = rgb[:,:,0]
G = rgb[:,:,1]
B = rgb[:,:,2]
Upvotes: 1
Reputation: 184171
You're getting the JPEG thumbnail embedded in the NEF. It's pretty cool that it got far enough into the file to find the thumbnail.
Upvotes: 3
Reputation: 1501
Did you check the Python Image Library's documentation? I don't see the Nikon RAW format (NEF) in the list of supported image formats. You'll need to find a library or application that explicitly supports this format, such as UFRaw.
Upvotes: 2