Skip to main content
Ramiro Araujo
Participant
July 6, 2020
Answered

How to rasterize smart object layers with scripting

  • July 6, 2020
  • 1 reply
  • 4071 views

Hi!

I'm pretty new on photoshop scripting. I see there's a rather obscure way I can't even understand 😅.

 

I've tried iterating though layers, detecting that it's a smart layer, but I can't seem to raster it. Ex, I tried this:

if(layerRef.kind == LayerKind.SMARTOBJECT) {
layerRef.rasterize(LayerKind.SMARTOBJECT)
}

And I'm getting:

Runtime Error: Error Code# 1227: Illegal argument - argument 1
- Wrong type of enumerated value @ file '' [line:0, col:NaN

 

Eventually, I would like to be able to raster smart objects, and then re-create that raster content into a smartobject again.

 

For the moment, I don't care much about performance, I just want this to work as readable as possible.

 

Thanks!!

This topic has been closed for replies.
Correct answer r-bin
Have you read about the rasterize function in the documentation?

Use instead
rasterize (LayerKind.SMARTOBJECT)
valid argument, e.g.
rasterize (RasterizeType.ENTIRELAYER)
 

1 reply

r-binCorrect answer
Legend
July 6, 2020
Have you read about the rasterize function in the documentation?

Use instead
rasterize (LayerKind.SMARTOBJECT)
valid argument, e.g.
rasterize (RasterizeType.ENTIRELAYER)
 
Ramiro Araujo
Participant
July 6, 2020

haha! that made it work! 

I've check the Photoshop Scripting Guide and Photoshop JavaScript Reference, I still don't see much info about the rasterize method.

 

Any help or directions on searching for creating a smart object from a given layer? 🙂

Legend
July 6, 2020