导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)相关的知识,希望对你有一定的参考价值。
Photoshop python scriptexport multiple files with each layerSet
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_()
以上是关于导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)的主要内容,如果未能解决你的问题,请参考以下文章