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

Getting Image Fill Color

Explorer ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Hello,

I am a bit of noob with scripting and code and I have searched the community before posting this but couldn't find a solution that worked.

I will be batch processing png images which have a single color to them. I need to extract that color and then apply effects to the images using the extracted color.

My question here is limited to the color extraction and getting the hex value in a variable. Please guide me with the same.

Thanks

TOPICS
Actions and scripting

Views

748

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

correct answers 1 Correct answer

Community Expert , May 31, 2018 May 31, 2018

Another possible solution, also using the histogram, would be to use the magic wand took to select a corner of the image. This should be white, according to your samples. Once the selection is made, inverse it, then get your histogram data. Now there should be just one spike in each of the channels.

Votes

Translate

Translate
Adobe
Community Expert ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Can you post an example of the image file? Is the color a swatch in the photo or is the photo just one tone?

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
Explorer ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Thanks for your reply. Here are some of the sample images. These are png files and one tone. Color picker cannot be used as I have to process large number of files and also picking color from a specific pixel location wont work as the image might be empty in the defined pixel location.

apps_evernote.pngapps_bbm.pngapps_foursquare.png

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 ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

You can probably get the color by using the histogram info. By getting the histogram figures and creating a loop to find which values have the greatest numbers, you can get the color. Obviously the rgb values for 255 will be high with the white, but there should be secondary spikes in the numbers. If there are no second spikes, you can assume that one of the channels also has a value of 255, like solid red.

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 ,
May 31, 2018 May 31, 2018

Copy link to clipboard

Copied

Another possible solution, also using the histogram, would be to use the magic wand took to select a corner of the image. This should be white, according to your samples. Once the selection is made, inverse it, then get your histogram data. Now there should be just one spike in each of the channels.

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
Contributor ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

Bonjour

You can select the bottom of the image with the function selectColorRange () - HERE

Then reverse the selection and take its coordinates

then use the ColorSamplers method on a point close to the color - modifying it if the color is that of the bottom

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
Explorer ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

Thanks you I was able to achieve the desired result with the solution you provided

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
Contributor ,
Jun 01, 2018 Jun 01, 2018

Copy link to clipboard

Copied

LATEST

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