'Rasterize layer in Photoshop with Python
I am trying to rasterize an imported image in a .psd file. When I import it with the current code it comes as a smart object, and I need to rasterize it. The last line is not working and been trying different combinations.
I am using photoshop python API.
Thank you.
from photoshop import Session
with Session("C:/Users/Admin/Documents/images/edit_wall.psd", action="open") as ps:
doc = ps.active_document
desc = ps.ActionDescriptor
desc.putPath(ps.app.charIDToTypeID("null"), "C:/CG_CONTENT/wall_height.exr")
event_id = ps.app.charIDToTypeID("Plc ") # `Plc` need one space in here.
ps.app.executeAction(ps.app.charIDToTypeID("Plc "), desc)
currentLayer = doc.activeLayer
doc.rasterize(currentLayer)
error:
'Document' object has no attribute 'rasterize'
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
