代码之家  ›  专栏  ›  技术社区  ›  guerda

如何在The Gimp中复制指南?

  •  1
  • guerda  · 技术社区  · 16 年前



    好的,我发现了一些有趣的函数:

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

    2 回复  |  直到 16 年前
        1
  •  5
  •   MarkusQ    16 年前

    我真的很想帮助你,但我不确定我是否理解你想做什么。你能编辑这个问题以提供更多细节吗?

    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)
    

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

        2
  •  1
  •   Anthony    8 年前

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