Lightroom Plugin SDK: getRawMetadata('colorNameForLabel') returns 'grey'

  • 1
  • Problem
  • Updated 3 years ago
  • (Edited)
Dear Photoshop Team,

This Problem is related to the plug-in creation for Lightroom.

I noticed a curious return from the function photo:getRawMetadata('colorNameForLabel'), as I got 'grey' (while I was expecting 'none', and I can't find the 'grey' return documented from Adobe SDK).

Obviously, this input is not accepted in the photo:setRawMetadata('colorNameForLabel', 'grey').


Maybe you have an idea how to solve this Problem?

Photo of Silvain Abadie

Silvain Abadie

  • 1 Post
  • 0 Reply Likes
  • confused

Posted 3 years ago

  • 1
Photo of Rob Cole

Rob Cole

  • 4831 Posts
  • 370 Reply Likes
From my point of view, this is mostly just a documentation error of the getter (and setter) function.

In other words, it returns 'grey' (reasonable), instead of 'none' (what's documented), when photo has no label. (also, the setter function doc says 'none' and should have said 'grey').

Note: there are 2 ways to set photo labels programmatically:
1. photo:setRawMetadata( 'colorNameForLabel', colorName ) -- or
2. photo:setRawMetadata( 'label', "label-text" )

'1' means set to a color by name - text to come from active label set.
'2' means set to specified text - color to come from active label set (or will be white).

One solution to the "problem":

if "photo to have a color/text label" then
if "set by color" then
photo:setRawMetadata( 'colorNameForLabel', labelColor )
else -- set by text
photo:setRawMetadata( 'label', labelText )
if "clear by text" then
photo:setRawMetadata( 'label', "" ) -- clear label (pass "", not nil).
else -- clear by color
photo:setRawMetadata( 'colorNameForLabel', 'grey' ) - clear by color.
-- photo:setRawMetadata( 'colorNameForLabel', 'none' ) - does not work.

|> Silvain Abadie wrote: "Obviously, this input is not accepted in the photo:setRawMetadata('colorNameForLabel', 'grey')"

Works for me in Lr5.7 - Windows, but if not universally working, always clear by text instead of color (and consider reporting a separate bug against set-raw-metadata method).