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

How to parse colours of each pixel and compare

Engaged ,
Jan 09, 2023 Jan 09, 2023

I work with some CMYK tiff files, and i need to check is there pixels which are made with mix of two specified colors, for example CYAN and BLACK and alert user if that its true or not. Is it possible (and how) to check that with javascrpt or anyhow to parse colors of each pixel and compare them?

Thanks in advance

TOPICS
Actions and scripting
821
Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Checking each pixel individually is usually not plausible (at least for images of any significant size), but I expect it should possible to utilize a workaround that ultimately uses the histogram to determine the overlap. 

 

What’s the point of the task?  

Translate
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
Engaged ,
Jan 09, 2023 Jan 09, 2023

I am working with some files that will be printed on flexo maschine, my needs are to check if there is mixing of certain colors to avoid the possibility of Moire effect 

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Which exact colors? 

Are there Spot Colors involved? 

Translate
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
Engaged ,
Jan 09, 2023 Jan 09, 2023

Yes, it sometimes contains spot colors, but it's enough for me to check for CMYK as well. There is no unique combinations, it is necessary to compare only those colors that are printed at the same angle, but let's say that I have solved that part, but I still have this problem - how to compare the values of two channels in each pixel?

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

When you use Channels you can access their Histograms – an Array of 255 integers – via Script. 

No overlap would mean the white value’s integer should be equal to the total number of pixels of the image and an if-clause can beused to check that. 

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

I would recommend you try to work out a way using the Channels and the resulting Histogram – then you can automate that with with a Script. 

The creation of a temp File or Channel for the operations and evaluation of the Histogram would probably be noticable (before it is closed or deleted), but depending on the images’ sizes it might not take long. 

Screenshot 2023-01-09 at 11.28.22.png

Translate
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 ,
Jan 09, 2023 Jan 09, 2023
LATEST

Wouldn't moiré only be a concern if more than 3 channels/plates were in play for the colour (presuming angles were correctly spaced for 2 and 3 colours)?

 

EDIT: You must have say 6 or more inks and there is a possibility that two inks may clash as you may have a good angle for one colour combination, but not another.

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

I'm by no means an expert on print, but it sounds like you're talking about colors going out of gamut.

In this case, you could tackle this with a color range action.

 

Make 3 new actions, "Gamut Check", "isProblem", "isGood"

 

for the "gamut check" action:

  1. Record a color range step where you select "out of gamut" as the target (bottom of the list)

2. add a conditional step (on the action panel, go to the menu, select "add conditional step")

3. set this step to "document has a selection", then play action to "isProblem", and Else Play Action to "isGood"

4. stop recording gamut check

 

for the isProblem action:

1. add a Stop (on the action panel, go to the menu, select "add Stop...")

2. write whatever message you want to inform your user

3. stop recording isProblem

 

for isGood:

1. do what you want to do in case there is no problem. Can be nothing, can be something, up to you.

 

To use it:

The user can now play the "Gamut Check" action and will be informed if there are problems.

You can also link this action to an event in the Events manager so it is played every single time a document is opened and the user will not have to do anything. (But will be bothered every single time a document is opened)

 

All the best & good luck! 🙂

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Another option....

 

Do a color range on your cyan channel with 0 fuziness at max value, store it to an alpha channel

Do a color range on your black channel with 0 fuziness at max value, store it to another alpha channel

Select one and intersect it with the other.

 

If you have a selection: you have the condition you described and can alert as per my previous post (conditional "has selection" bla bla bla)

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Do a color range on your cyan channel with 0 fuziness at max value, store it to an alpha channel

Or simply duplicate the Channel. 

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Simply duplicating will not filter any values though, so it won't be any clearer whether there is an issue.

But but but! Duplicating IS faster than color range, so if you duplicate and do a threshold filter on the resulting channel, you can filter your values!

 

So yeah, duplicate cyan & black to a new channel, threshold at whatever value you desire (100% as per OP) then intersect them and check for a selection is probably fastest & most accurate!

Translate
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 ,
Jan 09, 2023 Jan 09, 2023

Add a color fill layer and make it bright red for example (anything that will show up strongly)

Right click that layer and choose Blending options

Go to Blend if

Set the underlying layer blend if values to the combination of channel values that you want to be highlighted

 

Dave

Translate
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