导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)相关的知识,希望对你有一定的参考价值。

Photoshop python script
export multiple files with each layerSet
  1. import sys
  2. from PyQt4.QtGui import *
  3. import comtypes.client
  4.  
  5. class LayerSetsExporter(QWidget):
  6.  
  7. def __init__(self, parent = None):
  8. super(LayerSetsExporter, self).__init__(parent)
  9. self.createLayout()
  10. self.createConnection()
  11.  
  12. def setLayerSetsVisible(self, layerSets, state):
  13. for layerSet in layerSets:
  14. layerSet.visible = False
  15.  
  16. def processRun(self):
  17. outputPath = 'D:/Python/Temp/'
  18.  
  19. app = comtypes.client.CreateObject('Photoshop.Application')
  20. doc = app.activeDocument
  21.  
  22. optionJpg = comtypes.client.CreateObject('Photoshop.JPEGSaveOptions')
  23. optionJpg.quality = 8
  24.  
  25. count = 0
  26. layerSets = doc.layerSets
  27. for layerSet in layerSets:
  28. self.setLayerSetsVisible(layerSets, False)
  29. layerSet.visible = True
  30. doc.saveAs(outputPath + str(count) + '.jpg', optionJpg, True)
  31. count += 1
  32.  
  33. def createLayout(self):
  34. self.btnRun = QPushButton('&Run')
  35. layout = QVBoxLayout()
  36. layout.addWidget(self.btnRun)
  37.  
  38. self.resize(200,100)
  39. self.setWindowTitle('PS LayerSets Exporter')
  40. self.setLayout(layout)
  41.  
  42. def createConnection(self):
  43. self.btnRun.clicked.connect(self.processRun)
  44.  
  45. qApp = QApplication(sys.argv)
  46.  
  47. exporter = LayerSetsExporter()
  48. exporter.show()
  49.  
  50. qApp.exec_()

以上是关于导出每个图层集的JPEG文件(带有PyQt的Photoshop Python)的主要内容,如果未能解决你的问题,请参考以下文章

IfcRelAssociatesMaterial

IfcRelAssociatesMaterial

导出栅格怎么选择像素大小

如何在导出图层之前将1条调整曲线应用于每个图层(渲染为视频)?

gis三个图层一起导出

ArcGIS导出含注记的图层操作