Pulling RGB data from Layer Mask

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

jay

Pulling RGB data from Layer Mask

Post by jay »

Hello,

I've been asked if there's a way to pull the RGB color value out of a layer mask (from the Layer Mask Display Options dialog). I'm thinking it should be possible through the Action Manager, but can't figure out how to retrieve this data.

I've gathered info from this forum that you can indeed pull data from ActionReferences:

Code: Select allvar ref = new ActionReference();
ref.putEnumerated(charIDToTypeID("Lyr "), charIDToTypeID("Ordn"), charIDToTypeID("Trgt"));
var desc = executeActionGet(ref);

$.writeln(desc.getString(charIDToTypeID('Nm  ')));  // Get active layer name

So I'm wondering, is there a way to pull the red ('Rd '), green ('Grn ') and blue ('Bl ') data from the layer mask with charIDToTypeID("RGBC")?

Thank you.

Jay

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

Pulling RGB data from Layer Mask

Post by Mike Hale »

I am not sure what you are asking. A user or pixel layer mask is a single channel so it only contains grayscale data.

The mask display option is a panel option and is the same for all layer masks( similar to the quick mask color ). So a layer descriptor will not have that info. And it appears that you can use scriptlistener to set the color but I don't see a way to get the current color.

You can use Action Manager( scriptlistener ) to get some info that you can't get using the Object Model. But there are still a lot of setting that can't be access by either.
jay

Pulling RGB data from Layer Mask

Post by jay »

Hi Mike,

Thank you for your reply. And I believe you have answered my question - which is that the ActionReference won't contain the color data. I've seen examples where it can be set, but not where it can be retrieved.

I'm not very familiar with Photoshop channels and masks, as well as how they work, so I apologize if my question was a bit confusing. I'm not even sure why our client wants this color info, but after researching and testing through the day, the next best place is this forum.

Thanks again for taking the time to share your knowledge.

Jay