Skip to main content
davidd92744211
Known Participant
January 26, 2023
Question

LR SDK - Get histogram levels

  • January 26, 2023
  • 1 reply
  • 218 views

Hi there,

 

I had a good look through the Lightroom Classic SDK to see if it's possible to determine for the selected photos, the current histogram levels, specifically the midtone levels.

 

I looked at photo:getDevelopSettings() and photo:getRawMetadata() and neither return the RAW file's levels.

 

I am trying to create a script to adjust the midtones to make them just clip in the highlights. To do this I first need to determine the current levels which seems impossible.

 

Any help would be appreciated.

 

Thanks,

David

This topic has been closed for replies.

1 reply

johnrellis
Legend
January 26, 2023

The LR SDK doesn't provide direct access to the pixels of an image.  To do that, a plugin needs to export the image as a TIFF or PNG and read the pixels from the exported file. A couple of my plugins use Imagemagick to convert the TIFF to PPM format, which is easier to read with a small amount of Lua code. Not very fast, but fast enough for my needs.

davidd92744211
Known Participant
January 26, 2023

Thanks John for the reply. Thanks for the suggestion of your plugins. I really need to only work with DNG files though.

johnrellis
Legend
January 27, 2023

"I really need to only work with DNG files though."

 

Especially if the DNG contains raw sensor data, the only practical option is for your plugin to export a TIFF from LR's rendering of that raw sensor data and then read the pixel values from the TIFF (or a PPM created from the TIFF).