Python 16-bit linear TIFFs

Hi,

I’m interested in automating some of the processing of files created in: Convert .CR2 camera RAW to Linear RGB

I would like to:

a) import a linear 16-bit TIFF
b) get the RGB pixel values within a fixed rectangle
c) calculate the mean average Luma (Y) value

Could this be done in Python Pillow?

PS I found a way to do the RAW processing in DCRAW and AWK. Would love to try to add BT.2020 to DCRAW output if that’s possible?

@st599 Welcome to the forum!

  1. dcraw: I would contact its author https://www.cybercom.net/~dcoffin/dcraw.

  2. Pillow: probably but I am not familiar with it. I would use G’MIC or ImageMagick. E.g., in G’MIC:

gmic sample cat crop 10,5,60,80 rgb2ycbcr s c k...
  1. input cat sample image
  2. crop rectangle
  3. convert linear RGB to YCbCr
  4. split channels
  5. keep Y’

http://gmic.eu/reference.shtml

Edit: Sorry, you specifically asked for Rec. 2020. Maybe @David_Tschumperle could help you with that; e.g., provide the option to select the Rec.