Revision: 65363
Updated Code
at November 25, 2013 01:40 by janusoo
Updated Code
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_()
Revision: 65362
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 25, 2013 01:33 by janusoo
Initial Code
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(layerSet, 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_()
Initial URL
Initial Description
Photoshop python script export multiple files with each layerSet
Initial Title
Export JPEG Files with each LayerSet (Photoshop Python with PyQt)
Initial Tags
python
Initial Language
Python