如何在 Wand 0.6.5 中创建带名称的 Photoshop 图层
How to create Photoshop Layers with Names in Wand 0.6.5
我正在寻找使用 python ImageMagic Wand 和命名图层创建图像的示例。如何为 photoshop (PSD) 文件设置图层名称?
```# Create Image (Layer0)
with Image(
width=int(configuration['layer0']['width']),
height=int(configuration['layer0']['height']),
background=Color('Lime'),
format='psd'
) as boxcover:
boxcover.iterator_first()
boxcover.pseudo(4096,2048, 'xc:gold')
with Drawing() as layer:
layer.font_size = 72
layer.font_family = 'Arial'
layer.text(100,100,'Hello')
layer.draw(boxcover)
boxcover.iterator_set(1)
boxcover.pseudo(4096,2048, 'xc:purple')
debug_layers(boxcover,'/Users/colin/Downloads/debug.png')
boxcover.save(filename='/Users/colin/Downloads/test1.psd')
```
我对 PSD 格式没有太多经验,但是对于 wand,您需要在阅读之前设置 'label'
属性 (Image.options['label']
) /创建一个新图层。
with Image(width=4096, height=2048, pseudo='xc:lime') as boxcover:
boxcover.options['label'] = 'First Layer'
boxcover.pseudo(4096,2048, 'xc:gold')
with Drawing() as layer:
layer.font_size = 72
layer.font_family = 'Arial'
layer.text(100,100,'Hello')
layer.draw(boxcover)
boxcover.options['label'] = 'Second Layer'
boxcover.pseudo(4096,2048, 'xc:purple')
boxcover.save(filename='test1.psd')
我们可以使用 identify
实用程序进行验证。
$ identify -format '%[filename] %[page] %[label]\n' test1.psd
test1.psd 4096x2048
test1.psd 4096x2048 First Layer
test1.psd 4096x2048 Second Layer
我正在寻找使用 python ImageMagic Wand 和命名图层创建图像的示例。如何为 photoshop (PSD) 文件设置图层名称?
```# Create Image (Layer0)
with Image(
width=int(configuration['layer0']['width']),
height=int(configuration['layer0']['height']),
background=Color('Lime'),
format='psd'
) as boxcover:
boxcover.iterator_first()
boxcover.pseudo(4096,2048, 'xc:gold')
with Drawing() as layer:
layer.font_size = 72
layer.font_family = 'Arial'
layer.text(100,100,'Hello')
layer.draw(boxcover)
boxcover.iterator_set(1)
boxcover.pseudo(4096,2048, 'xc:purple')
debug_layers(boxcover,'/Users/colin/Downloads/debug.png')
boxcover.save(filename='/Users/colin/Downloads/test1.psd')
```
我对 PSD 格式没有太多经验,但是对于 wand,您需要在阅读之前设置 'label'
属性 (Image.options['label']
) /创建一个新图层。
with Image(width=4096, height=2048, pseudo='xc:lime') as boxcover:
boxcover.options['label'] = 'First Layer'
boxcover.pseudo(4096,2048, 'xc:gold')
with Drawing() as layer:
layer.font_size = 72
layer.font_family = 'Arial'
layer.text(100,100,'Hello')
layer.draw(boxcover)
boxcover.options['label'] = 'Second Layer'
boxcover.pseudo(4096,2048, 'xc:purple')
boxcover.save(filename='test1.psd')
我们可以使用 identify
实用程序进行验证。
$ identify -format '%[filename] %[page] %[label]\n' test1.psd
test1.psd 4096x2048
test1.psd 4096x2048 First Layer
test1.psd 4096x2048 Second Layer