Skip to main content
Participant
November 8, 2023
Question

Please provide the code to change image color mode in automation plugin

  • November 8, 2023
  • 1 reply
  • 186 views

Hi 
I want to change the color mode of the document to rgb 
this is the code that i have got from history how do i make use of it to create a function that convert color mode to rgb.

 

SPErr PlayGetting History Info(/*your parameters go here*/void)
{
     PIActionDescriptor result = NULL;
     DescriptorTypeID runtimeKeyID;
     DescriptorTypeID runtimeTypeID;
     DescriptorTypeID runtimeObjID;
     DescriptorTypeID runtimeEnumID;
     DescriptorTypeID runtimeClassID;
     DescriptorTypeID runtimePropID;
     DescriptorTypeID runtimeUnitID;
     SPErr error = kSPNoError;
     // Move this to the top of the routine!
     PIActionDescriptor desc0000000000000a50 = NULL;

     error = sPSActionDescriptor->Make(&desc0000000000000a50);
     if (error) goto returnError;

     // Unicode String as UTF8: RGB Color
     error = sPSActionDescriptor->PutString(desc0000000000000a50, keyName, "RGB Color");
     if (error) goto returnError;

     error = sPSActionDescriptor->PutInteger(desc0000000000000a50, keyItemIndex, 3);
     if (error) goto returnError;

     error = sPSActionDescriptor->PutInteger(desc0000000000000a50, keyCount, 3);
     if (error) goto returnError;

     error = sPSActionDescriptor->PutBoolean(desc0000000000000a50, keyAuto, true);
     if (error) goto returnError;

     error = sPSActionDescriptor->PutBoolean(desc0000000000000a50, keyHistoryBrushSource, false);
     if (error) goto returnError;

     error = sPSActionDescriptor->PutBoolean(desc0000000000000a50, keyCurrentHistoryState, true);
     if (error) goto returnError;

     error = sPSActionDescriptor->PutInteger(desc0000000000000a50, keyID, 80);
     if (error) goto returnError;

     error = sPSActionControl->StringIDToTypeID("Getting History Info", &runtimeEventID);
     if (error) goto returnError;

     error = sPSActionControl->Play(&result, runtimeEventID, desc0xa50, plugInDialogSilent);
     if (error) goto returnError;

returnError:
     if (result != NULL) sPSActionDescriptor->Free(result);
     if (desc0000000000000a50 != NULL) sPSActionDescriptor->Free(desc0000000000000a50);
     return error;
}

 

 

I would really appreciate any thoughts/suggestions on the matter.

 

Thanks all.

This topic has been closed for replies.

1 reply

GNDGN
Inspiring
November 8, 2023

Changing color mode in PS to RGB via script:

app.activeDocument.changeMode(ChangeMode.RGB);

 

____________________Robotic Process Automation in Desktop Publishing (Book): https://doi.org/10.1007/978-3-658-39375-5