【发布时间】:2019-08-02 23:02:32
【问题描述】:
我想在 psd 文件中添加一个文本层。我能够添加一个图层,但我不知道如何编写内容或在该图层中定位内容。 谁能告诉我?
我导入了 win32com,这就是我现在得到的。
import win32com.client
psApp = win32com.client.Dispatch("Photoshop.Application")
psApp.Open('file path') # Opens a PSD file
doc = psApp.Application.ActiveDocument # Get active document object
layers = doc.ArtLayers
newTextLayer = layers.add # add a layer
newTextLayer.kind = 2 # specify a text layer
newTextLayer.name = 'new' # name the layer
newTextLayer = 'text content' # this line is what I am struggling with.
doc.save
doc.close
编辑:我使用的是 python 3.6。和 Photoshop CC。
【问题讨论】:
标签: python-3.x photoshop win32com