如何在 The Gimp 中复制引导线?

发布于 2024-07-14 18:55:19 字数 427 浏览 11 评论 0原文

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

如果有一点 script-fu 脚本就好了。

好的,我发现了一些有趣的功能:

(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)

提前致谢!

Is it possible to copy guide lines from one image to another?
I need this because I have several images that need exactly the same composition, so I want to use the guide lines for this.
There's no option to select & copy a guide line, so I must add them manually.

It would be nice, if there's a little script-fu script.

Okay, there are some interesting functions I found:

(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)

Thanks in advance!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

回眸一遍 2024-07-21 18:55:20

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

猜测(等待更多信息)您是否在寻找类似的东西?

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)

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

但第一个问题是你想要实现什么?——之后我们可以担心如何实现的细节。

I'd really like to help you but I'm not sure I understand what you are trying to do. Could you edit the question to provide more details?

At a guess (pending more information) are you looking for something like this?

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)

Note that this is pseudo-code, since the functions you mentioned seem to be part of an API that is using a syntax other than scheme-ish script fu.

But the first question is what are you trying to accomplish? -- after that we can worry about the details of how.

雨巷深深 2024-07-21 18:55:20

一直想学习 Gimp 脚本 (PythonFu) 一段时间并需要此功能,我使用了 MarkusQ 提供的伪代码和这个方便的教程 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 的插件目录(请参阅“首选项”>“文件夹”),然后重新启动 Gimp 以在“工具”下看到 CopyGuideline 选项。 然后打开这两个图像,选择带有指南的图像,然后选择 CopyGuidelines 来运行脚本。

Having been wanting to learn Gimp Scripts (PythonFu) for a while and requiring this functionality I used the Pseudo code provided by MarkusQ and this handy tutorial https://jacksonbates.wordpress.com/python-fu-gimp-scripting-tutorial-pages/ to create a script to copy guidelines from one image to another.

#!/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()

You'll need to copy this in to a CopyGuidelines.py file and put it your Gimp's plugin directory (See Preferences > Folders ) and restart Gimp to see the CopyGuideline option under Tools. Then open up the two images, select the one with the Guidelines and select CopyGuidelines to run the script.

残龙傲雪 2024-07-21 18:55:20

我无法让其他答案中发布的脚本正常工作,但如果其他人遇到此问题并且需要简单的答案:

您可以打开图像,在第一个图像上绘制指南,然后复制并粘贴其他图像作为原始图层上的新图层。 该指南将保持不变。

I couldn't get the script posted in the other answer to work, but if anyone else comes across this and needs the easy answer:

You can open the images, draw the guidelines on the first one, and then copy and paste the other images as new layers over the original. The guidelines will remain in place.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文