• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Getting average rgb value of an image on photoshop with javascript?

New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Hi guys. Bare with me but I have no experience with javascript at all and i've been looking up tutorials on how to do this with javascript and a lot of what's coming out has to do with creating a canvas in HTML which isn't possible for the photoshop script i'm doing. I looked at the javascript reference for photoshop cc and saw that there is a Colorsamplertool and I was wondering if this is the way to go? Although i'm not quite sure how this works.

TOPICS
Actions and scripting

Views

1.3K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Perhaps it would be better if you try to describe what it is that you want to do.Use your own words do not try to use any Photoshop terms like Photoshop script  or use web technology like HTML.  Don't talk javascript you do not know it.  Describe what it is that you want to be able to do.

JJMack

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Basically, I want to make a photoshop script that will change the color of a text in a text layer depending on  how light or dark the background image is. I figured that to achieve this I would need to get the rgb values of the background image and when I was searching around people mentioned something about the color sampler tool that photoshop has.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Advisor ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

Resize the to 1px x 1px with interpolation turned on then check the rgb value of that pixel. It's the simplest thing I can think of so give it a try and let us know how it works out.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

how would i particularly do this with javascript? and what does interpolation mean hah

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Apr 06, 2017 Apr 06, 2017

Copy link to clipboard

Copied

LATEST

Using scriptListener, you could create a merged stamp visible layer ctrl-alt-shift-e for win. Then apply the average filter. You can then use the colorsampler to get what the average rgb value is and adjust the text layer accordingly. You can then delete the merged layer.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines