/ Published in: Python

Photoshop python script
export multiple files with each layerSet
export multiple files with each layerSet
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
import sys from PyQt4.QtGui import * import comtypes.client class LayerSetsExporter(QWidget): def __init__(self, parent = None): super(LayerSetsExporter, self).__init__(parent) self.createLayout() self.createConnection() def setLayerSetsVisible(self, layerSets, state): for layerSet in layerSets: layerSet.visible = False def processRun(self): outputPath = 'D:/Python/Temp/' app = comtypes.client.CreateObject('Photoshop.Application') doc = app.activeDocument optionJpg = comtypes.client.CreateObject('Photoshop.JPEGSaveOptions') optionJpg.quality = 8 count = 0 layerSets = doc.layerSets for layerSet in layerSets: self.setLayerSetsVisible(layerSets, False) layerSet.visible = True doc.saveAs(outputPath + str(count) + '.jpg', optionJpg, True) count += 1 def createLayout(self): self.btnRun = QPushButton('&Run') layout = QVBoxLayout() layout.addWidget(self.btnRun) self.resize(200,100) self.setWindowTitle('PS LayerSets Exporter') self.setLayout(layout) def createConnection(self): self.btnRun.clicked.connect(self.processRun) qApp = QApplication(sys.argv) exporter = LayerSetsExporter() exporter.show() qApp.exec_()
Comments
