是否可以将引导线从一个图像复制到另一个图像?
我需要这个,因为我有几个图像需要完全相同的组成,所以我想使用指导线。
没有选择& amp;复制指南,所以我必须手动添加它们。

如果有一个小脚本脚本,那就太好了。

好的,我找到了一些有趣的功能:

(gimp-image-find-next-guide image index)
(gimp_image_add_hguide image xposition)
(gimp_image_add_vguide image yposition)
(gimp_image_get_guide_orientation image guide)
(gimp_image_get_guide_position image guide)

提前致谢!

有帮助吗?

解决方案

我真的很想帮助你,但我不确定我明白你要做什么。您可以编辑问题以提供更多详细信息吗?

猜测(等待更多信息)你在找这样的东西吗?

guide = 0
while guide = gimp_image_find_next_guide (image_1,guide) != 0
     position = gimp_image_get_guide_position (image_1,guide)
     if gimp_image_get_guide_orientation (image_1,guide) == 0
          gimp_image_add_hguide (image_2,position)
        else
          gimp_image_add_vguide (image_2,position)

请注意,这是伪代码,因为您提到的函数似乎是使用scheme-ish script fu之外的语法的API的一部分。

但第一个问题是你想要完成什么? - 之后我们可以担心如何细节。

其他提示

我一直想学习Gimp Scripts(PythonFu)并需要这个功能,我使用了MarkusQ提供的Pseudo代码和这个方便的教程 https://jacksonbates.wordpress.com/python-fu-gimp-scripting-tutorial-pages/ 创建脚本以复制指南从一个图像到另一个图像。

#!/usr/bin/env python

from gimpfu import *

def CopyGuidelines(image_1, drawable, image_2):     
    guide = pdb.gimp_image_find_next_guide(image_1, 0)
    while guide != 0 :
        position = pdb.gimp_image_get_guide_position (image_1,guide)        
        if pdb.gimp_image_get_guide_orientation (image_1,guide) == 0:
            pdb.gimp_image_add_hguide (image_2,position)
        else:
            pdb.gimp_image_add_vguide (image_2,position)
        guide = pdb.gimp_image_find_next_guide (image_1,guide)      

register(
    "python-fu-CopyGuidelines",
    "Copy Guidelines",
    "Copy Guidelines from one image to another",
    "Anthony", "JustAGuyCoding", "2017",
    "Copy Guidelines",
    "", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
    [
        (PF_IMAGE, "image_1", "takes current image", None),
        (PF_DRAWABLE, "drawable", "Input layer", None),
        (PF_IMAGE, "image_2", "takes other image", None)
    ],
    [],
    CopyGuidelines, menu="<Image>/Tools")  

main()

您需要将其复制到CopyGuidelines.py文件并将其放入Gimp的插件目录(请参阅首选项&gt;文件夹)并重新启动Gimp以查看Tools下的CopyGuideline选项。然后打开这两个图像,选择指南中的图像并选择CopyGuidelines以运行脚本。

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top