Skip to main content
Mattmcquiff
Inspiring
May 4, 2021
Question

Photoshop script, get RGB Values from Color sampler tool

  • May 4, 2021
  • 1 reply
  • 3703 views

Hi, I'm not too good at scripting, so looking for some help.

 

I would like to get let the user to select a point of the image, then I would need to set variables to the location of the sample point and also collect the RGB Values as variables too.

I've used the script listening but not too sure how to gather that information.

 

I also like to use it back with applescript that I can follow.

 

Many Thanks

 

Matt

This topic has been closed for replies.

1 reply

Kukurykus
Legend
May 4, 2021
Mattmcquiff
Inspiring
May 5, 2021

Great thanks, I can't get that to return the RGB Values to applescript or the Alert in JS to display them.

 

tell application id "com.adobe.photoshop"
	activate
	
	set RGBValue to do javascript "#target photoshop var doc = app.activeDocument, samps = doc.colorSamplers; for ( var i = 0; i < samps.length; i++ ) {            var r = Math.round( samps.color.rgb.red ),      g = Math.round( samps.color.rgb.green ),      b = Math.round( samps.color.rgb.blue );      return( r+g+b );       } alert ( samps[1].position );	"
	log RGBValue
end tell