Copy link to clipboard
Copied
I want to script new feature added to Photoshop CS6 "Rasterize Layer Style". I tried Layer.RasterizeLayerStyle() but this function doesn't exist.
I know that I still can add an empty layer below the layer and merge them together, but it would be much easier and the code would be more readable if I can use "Rasterize Layer Style" command in my script.
Copy link to clipboard
Copied
Did you try installing the optional Scriptlisener Plug-in to see if it recorded anything. Though Layer>Rastersize>Layer Style is new you could always accomplish what it does other ways. Like merging visible layers where one layer is empty. It just rasterize the layer along with its layer style. In fact if the layer in question was a smart object layer after the "Rasterize Layer Style" operation that is exactly whet you will have a raster layer no longer will it be a smart object layer.
Adobe shortchange scripting in CS6 for example you can not read the usere interpolation Photoshop preference if its set to the new default setting Bicubic Automatic and you can not set it to Bicubic Automatic if you read that it is not set to Bicubic Automatic. Adobe simply dropped the ball and did not add the nessary update to support CS6 new features to scripting and installing the sicptlistner will turn off a new feature like allowing tool recording. CS6 is by far the buggest release of Photoshop I ever installed. The list of the Photoshop versions I have installed is
PS3
PS5
PS5.5
PS7
CS
CS2
CS3
CS5
CS6
I use CS3. The money I sent upgrading to CS5 and CS6 so far has been a wast of money... Phehaps Adobe will fix the bugs and not deferr them to some future release like they historically do.
Copy link to clipboard
Copied
Are you familiar with ScriptingListener.plugin?
// =======================================================
var idrasterizeLayer = stringIDToTypeID( "rasterizeLayer" );
var desc5 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
var ref4 = new ActionReference();
var idLyr = charIDToTypeID( "Lyr " );
var idOrdn = charIDToTypeID( "Ordn" );
var idTrgt = charIDToTypeID( "Trgt" );
ref4.putEnumerated( idLyr, idOrdn, idTrgt );
desc5.putReference( idnull, ref4 );
var idWhat = charIDToTypeID( "What" );
var idrasterizeItem = stringIDToTypeID( "rasterizeItem" );
var idlayerStyle = stringIDToTypeID( "layerStyle" );
desc5.putEnumerated( idWhat, idrasterizeItem, idlayerStyle );
executeAction( idrasterizeLayer, desc5, DialogModes.NO );
Copy link to clipboard
Copied
this code select smart objects layer Only working
how to the all document smart objects to rasterize layer
Copy link to clipboard
Copied
That Action manager code most likely rasterizes the current active layer it select nothing on its own. You would need to loop through a document's layers and use that code for each smart object layer that has a layer style.
Copy link to clipboard
Copied
Paul Riggott posted code on rasterising all Smart Objects in a file once.
Copy link to clipboard
Copied
yes working thank you very much:)
Copy link to clipboard
Copied
Be careful with what you do to the layer after they are rasterized the are no longer smart object layers the objects pixels are now replace with a transform rendering of the original object pixels. The layers will no longer transform and resize like smart object layers do.
Copy link to clipboard
Copied
Sometimes the Rasterize Layer Style produces different results than flattening the layer effects: i.e merging with a new empty layer below.
So you might want to verify you get the same results.
One example is if you have a stroke added with the stroke option in the tool options bar and a color overlay in the layer styles dialog.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now