Skip to main content
Inspiring
July 7, 2021
Answered

Script copy paste layer color profile mismatch

  • July 7, 2021
  • 5 replies
  • 2045 views

Wondering if there is a better way to handle color profile mismatch when copying and pasting layers from two separate documents using a script? 

For instance source file jpg sRBGB and destination file psd Adobe RGB 1998.

Does the following sequence make sense to avoid a color profile mismatch and the Photoshop color mismatch alert dialog?

 

Open source doc

Define variable source doc color profile

Get source doc color profile

Write source doc color profile to external txt data file

Copy source doc layer

Close source doc without saving

 

Open destination doc

Define variable destination doc color profile

Get destination doc color profile

Read the external txt data file

Check color profile variables

If color profile mismatch

Convert destination doc color profile to source doc color profile. // avoids alert dialog

Copy source doc layer

Restore destination doc color profile

Else

Copy source doc layer

Save destination doc

Close destination doc

This topic has been closed for replies.
Correct answer r-bin
Question. Does such a code cause you to get a conversion alert?

5 replies

r-binCorrect answer
Legend
July 8, 2021
Question. Does such a code cause you to get a conversion alert?
Inspiring
July 8, 2021

Actually, this code works and bypasses the Paste Profile Mismatch alert dialog without having to disable the alert box manually.

In this case, does Photoshop silently convert the paste information to the destination document color profile? 

Legend
July 8, 2021

It does this according to the ColorSettings settings. If the policy for RGB == Off, then no conversion occurs. RGB numbers remain unchanged in the source and destination documents. Otherwise, the conversion occurs according to the rules specified in the same ColorSettings. Therefore, you still need to read and change, if necessary (temporarily) the parameters in the ColorSettings to be sure of the result. Maybe tomorrow I will show you how to read and change ColorSettings.

Kukurykus
Legend
July 7, 2021

Why don't you tick "Don't show again" box when alert pops up?

Inspiring
July 8, 2021

I don't always know if the alert box has been disabled. I am trying to bypass the alert box in case it has not been disabled. Is there a way to check if the alert box Paste Profile Mismatch has been disabled?

 

Legend
July 8, 2021
In the case of using the script and all  options turned on in ColorSettings, I have no alert (CS6).
D Fosse
Community Expert
Community Expert
July 7, 2021

You don't really need to match them. It will be correctly converted in the paste operation.

 

Turn off the dialog in color settings.

Inspiring
July 8, 2021

That would be the case if the color mismatch alert dialog is off. What happens if the PS system color profile alert dialog is on and the user runs the script on a batch of 100 images. Will the alert dialog pop for every single image with a different colors profile or only the first time it encounters the mismatch and the user checks do not show this message again? 

c.pfaffenbichler
Community Expert
Community Expert
July 7, 2021

Another point: Why the txt-file and not compare the profiles within the Script? 

Inspiring
July 8, 2021

I was afraid the double copying would damage the file by causing data loss when going from Adobe RGB 1998 to sRGB and back to Adobe RGB 1998. In the workflow, the script opens and closes the source doc before opening the destination doc. So how would the comparing docs work? Do both source and destination doc need to be open simultaneously?

c.pfaffenbichler
Community Expert
Community Expert
July 7, 2021

»Convert destination doc color profile to source doc color profile. // avoids alert dialog

Copy source doc layer

Restore destination doc color profile«

That would mean a double conversion of the image – so you would be damaging the image.