I need to write a Python program for loading a PSD photoshop image, which has multiple layers and spit out png files (one for each layer). Can you do that in Python? I\'ve tried
You can use the win32com for accessing the Photoshop with Python. Possible pseudo code for your work:
import win32com.client
pApp = win32com.client.Dispatch('Photoshop.Application')
def makeAllLayerInvisible(lyrs):
for ly in lyrs:
ly.Visible = False
def makeEachLayerVisibleAndExportToPNG(lyrs):
for ly in lyrs:
ly.Visible = True
options = win32com.client.Dispatch('Photoshop.PNGSaveOptions')
options.Interlaced = False
tf = 'PNG file name with path'
doc.SaveAs(SaveIn=tf,Options=options)
ly.Visible = False
#pApp.Open(PSD file)
doc = pApp.ActiveDocument
makeAllLayerInvisible(doc.Layers)
makeEachLayerVisibleAndExportToPNG(doc.Layers)