我想得到一个特定的层在gimp与python。
我有两层的图像。我找到了num_layers, layer_ids = pdb.gimp_image_get_layers(image)命令
当我运行该命令时,我得到了输出
num_layers = 2
layer_ids = (5, 4)我找到了命令layer = pdb.gimp_image_get_layer_by_name(image, name)和layer = pdb.gimp_image_get_layer_by_tattoo(image, tattoo)。
如何获取特定层?
发布于 2021-10-05 09:37:04
image.active_layer来检索活动层,但是这很危险,你的插件可能已经在一个遮罩或通道上被调用了,使用前面的方法通常是这样做的。在Python-fu控制台中尝试执行某些操作时,此方法有其用处。- filter by name: `[l from image.layers if l.name='XXX'][0]`,- filter on position in the stack: - `image.layers[0]` for the top,
- `image.layers[-1]` for the "Background" at the bottom.- You can also find the first visible or linked.pdb.gimp_item_set_tattoo(item, tattoo),其中tattoo是作为签名选取的整数),然后使用pdb.gimp_image_get_layer_by_tattoo(image, tattoo)在后续处理中检索该层)。纹身将被保存为图像的一部分,因此将在工作会议结束后继续存在。https://stackoverflow.com/questions/69446459
复制相似问题