convertProfile

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

newuser666

convertProfile

Post by newuser666 »

Hi

I am using the following way to make a layer black and white

tempDoc.selection.select(tempoArray1,SelectionType.REPLACE,0,false);
makeDesatAdjustmentLayer();


function makeDesatAdjustmentLayer() {
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putClass( charIDToTypeID(""AdjL"") );
desc.putReference( charIDToTypeID(""null""), ref );
var adjDesc = new ActionDescriptor();
var presetDesc = new ActionDescriptor();
presetDesc.putEnumerated( stringIDToTypeID(""presetKind""), stringIDToTypeID(""presetKindType""), stringIDToTypeID(""presetKindDefault"") );
presetDesc.putBoolean( charIDToTypeID(""Clrz""), false );
adjDesc.putObject( charIDToTypeID(""Type""), charIDToTypeID(""HStr""), presetDesc );
desc.putObject( charIDToTypeID(""Usng""), charIDToTypeID(""AdjL""), adjDesc );
executeAction( charIDToTypeID(""Mk ""), desc, DialogModes.NO );
var desc = new ActionDescriptor();
var ref = new ActionReference();
ref.putEnumerated( charIDToTypeID(""AdjL""), charIDToTypeID(""Ordn""), charIDToTypeID(""Trgt"") );
desc.putReference( charIDToTypeID(""null""), ref );
var adjDesc = new ActionDescriptor();
adjDesc.putEnumerated( stringIDToTypeID(""presetKind""), stringIDToTypeID(""presetKindType""), stringIDToTypeID(""presetKindCustom"") );
var list = new ActionList();
var HSBDesc = new ActionDescriptor();
HSBDesc.putInteger( charIDToTypeID(""H ""), 0 );
HSBDesc.putInteger( charIDToTypeID(""Strt""), -100 );
HSBDesc.putInteger( charIDToTypeID(""Lght""), 0 );
list.putObject( charIDToTypeID(""Hst2""), HSBDesc );
adjDesc.putList( charIDToTypeID(""Adjs""), list );
desc.putObject( charIDToTypeID(""T ""), charIDToTypeID(""HStr""), adjDesc );
executeAction( charIDToTypeID(""setd""), desc, DialogModes.NO );
};

After this I take tempDoc and use convertProfile method to convert the color profile as printing of final output needs to be done with that profile. The final output has the new profile but some how the Hue/Saturation layer added to make the layer black and white disappears and the image again becomes colored. The color profile we are trying to convert to has CMYK color space. If I convert to a profile having RGB color space it maintains the Hue & Saturation layer to keep it grayscale.

Can anyone please explain why its doing that and how can it be fixed? Need help urgently.

Thanks in advance.

Professional AI Audio Generation within Adobe Premiere Pro - Download Free Plugin here

Mike Hale

convertProfile

Post by Mike Hale »

Most adjustment layer are discarded when converting document modes. You either need to flatten the doc before the mode conversion or add the adjustment layer after the conversion.
newuser666

convertProfile

Post by newuser666 »

Thanks for the reply Mike. If I want to convert the profile and then later apply the adjustment layer for black and white on one of the layers of the final document then it will be a bit difficult as somehow I will need to know which layer I want to apply the adjustment layer to in the first place. Flattening it may not be the ideal solution.

Thanks heaps.
Mike Hale

convertProfile

Post by Mike Hale »

Adjustment layer and some layer blend mode don't convert into other color modes. In the GUI Photoshop gives a warning dialog.

I'm not sure what you are trying to do but if you only want the adjustment layer to apply to one layer, merging that layer with the adjustment layer( using merge down ) will allow you to change modes. Because the adjustment layer was merged down it has already been applied and discarded.
newuser666

convertProfile

Post by newuser666 »

Hi Mike

Many thanks for replying.

What if I first assign or convert the whole document (when its blank i.e. no images have been put in the document yet) to the desired profile and then start putting the images as separate layers with adjustment layers. Can this have the same result or the new images added to the document wont have the new color profile assigned/converted and will it keep the adjustment layer then?