Skip to main content
Participant
June 17, 2012
Question

Scripting New "Rasterize Layer Style" feature of Photoshop CS6

  • June 17, 2012
  • 3 replies
  • 6047 views

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.

This topic has been closed for replies.

3 replies

Jeff Arola
Community Expert
Community Expert
June 18, 2012

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.

c.pfaffenbichler
Community Expert
Community Expert
June 17, 2012

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 );

saranr37921948
Known Participant
July 26, 2017

this code select smart objects  layer Only working

how to the all document smart objects to rasterize layer

JJMack
Community Expert
Community Expert
July 26, 2017

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.

JJMack
JJMack
Community Expert
Community Expert
June 17, 2012

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.

JJMack