Ejemplo n.º 1
0
 def register(self, proc_name, blurb, help, author, copyright, date, label,
              imagetypes, params=None, results=None, menu="<Image>/Layer/GIML-ML",
              domain=None, on_query=None, on_run=None):
     self.name = proc_name
     gfu.register(
         proc_name,
         blurb,
         help,
         author,
         copyright,
         date,
         label,
         imagetypes,
         params=[(gfu.PF_IMAGE, "image", "Input image", None),
                 (gfu.PF_DRAWABLE, "drawable", "Input drawable", None)]
                + (params or []),
         results=results or [],
         function=self.run_outer,
         menu=menu,
         domain=domain, on_query=on_query, on_run=on_run
     )
    }
    data.update( self.paramImage )
    self.conn.send( json.dumps( data ) )

  def quit(self):
    gimp.message( "%s: Stopped!" % self.titleServer)
    gimp_shelf['socket_server'] = False
    self.conn = None


def run():
  
  if gimp_shelf.has_key('socket_server') and gimp_shelf['socket_server']:
    gimp.message( "WARNING: '%s' is already running!" % SocketService.titleServer)
    return

  SocketService().run()

register(
  "python_fu_socket_server",
  SocketService.titleServer, SocketService.titleServer,
  "Luiz Motta", "IBAMA", "2016",
  "<Toolbox>/IBAMA/%s" % SocketService.titleServer,
  "",
  [],
  [],
  run
)

main()
Ejemplo n.º 3
0
    layer = pdb.gimp_image_merge_down(image, text_layer, 0)
    pdb.gimp_layer_set_name(layer, layer_name)




gimpfu.register(
    'python_text_border',
    'Creates a border around text.',
    'Creates a border around text.',
    'Rebecca Breu',
    '2016 Rebecca Breu, GPLv3',
    '12 March 2016',
    '<Image>/Layer/Text/Add text border...',
    'RGBA',
    [
        (gimpfu.PF_INT,
         'thickness',
         'Border thickness (pixel)',
         5),
        (gimpfu.PF_COLOUR,
         'colour',
         'Border colour',
         (0, 0, 0)),
    ],
    [],
    python_text_border,
)

gimpfu.main()
Ejemplo n.º 4
0
fu.register(
    "python_fu_gravilens_warp",
    "Gravitational Lens Warp",
    "Create gravitational lens effect over selected region.",
    "Andrey Zamaraev",
    "MIT License",
    "2018",
    "<Image>/Filters/Distorts/Gravitational Lens Warp",
    "GRAY*, RGB*",
    [
        (
            fu.PF_SLIDER,
            "inner_radius_percent", "Inner Radius, %",
            50, (0, 100, 0.1)
        ),
        (
            fu.PF_SLIDER,
            "outer_radius_percent", "Outer Radius, %",
            100, (0, 100, 0.1)
        ),
        (
            fu.PF_BOOL,
            "inside", "Render inside inner radius",
            False
        ),
    ],
    [],
    gravilens_warp
)
Ejemplo n.º 5
0
        )

gimpfu.register(
    # name
    "spine-export",
    # blurb
    "Spine export",
    # help
    "Exports layers to images and outputs a Spine JSON file",
    # author
    "Carlo Cabanilla",
    # copyright
    "Carlo Cabanilla",
    # date
    "2014",
    # menupath
    "<Image>/File/Export/Export to Spine",
    # imagetypes
    "*",
    # params
    [
        (gimpfu.PF_ADJUSTMENT, "compression", "PNG Compression level:", 0, (0, 9, 1)),
        (gimpfu.PF_DIRNAME, "dir", "Directory", "/tmp")
    ],
    # results
    [],
    # function
    spine_export
)

gimpfu.main()
Ejemplo n.º 6
0
                gpdb.file_jpeg_save(img, drawable, imageTmp, imageTmp,
                                    JPG_QUALITY, JPG_SMOOTHING, JPG_OPTIMIZE,
                                    JPG_PROGRESSIVE, JPG_COMMENT, JPG_SUBSMP,
                                    JPG_BASELINE, JPG_MARKERS, JPG_DCTALGO)

            elif CAPTCHA_FILE_EXT == ".png":
                gpdb.file_png_save2(img, drawable, imageTmp, imageTmp,
                                    PNG_INTERLACE, PNG_COMPRESSION, PNG_BKGD,
                                    PNG_GAMA, PNG_OFFSET, PNG_PHYS, PNG_TIME,
                                    PNG_COMMENT, PNG_SVGTRANS)

            else:
                return SystemExit("Image extension %r is not supported!" %
                                  CAPTCHA_FILE_EXT)
        except Exception as err:
            print(err)
            if os.path.isfile(imageTmp):
                os.unlink(imageTmp)
        else:
            os.rename(imageTmp, imagePath)


# Gimp-python boilerplate.
gimpfu.register(
    'captcha_generate', 'Generate CAPTCHAs', 'Generate CAPTCHAs',
    'Isis Lovecruft', 'Isis Lovecruft', '2014', '<Toolbox>/Xtns/Make-Captcha',
    '', [(gimpfu.PF_STRING, 'basedir', 'base directory for images', ''),
         (gimpfu.PF_INT, 'count', 'number of images to add', 0)], [],
    captcha_generate)
gimpfu.main()
Ejemplo n.º 7
0
                            file_h.write(line.replace('_', prefix + '_'))
                    else:
                        file_h.write(line)
                file_h.truncate()

        pdb.gimp_image_delete(image)

        # necessary ?
        pdb.gimp_context_pop()


register(
    "create_base_alphabet",
    "Create the base alphabet XBMs for a given font/size",
    "Create the base alphabet XBMs for a given font/size",
    "WanderingGlitch",
    "WanderingGlitch",
    "2016",
    "Create base alphabet",
    "",
    [
        (PF_FONT, "font", "Font face", "Ariel"),
        (PF_SPINNER, "font_size", "Font Size", 18, (10, 100, 1)),
        (PF_STRING, "string", "Directory base", ""),
    ],
    [],
    create_base_alphabet,
)

main()
Ejemplo n.º 8
0
from gimpfu import pdb, main, register, PF_STRING
#from gimpenums import ORIENTATION_HORIZONTAL
import os

def flip(file):
    fileabs = os.path.abspath(file)
    print(fileabs)
    file_dir, filename = os.path.split(fileabs)
    filename = filename.lower().replace('.png', '_mini.jpg')
    file_new = os.path.join(file_dir, filename)

    image = pdb.gimp_file_load(file, file)
    drawable = pdb.gimp_image_get_active_layer(image)

    #pdb.gimp_image_flip(image, ORIENTATION_HORIZONTAL)
    #pdb.gimp_file_save(image, drawable, file_new, file_new)

    pdb.file_jpeg_save(image, drawable, file_new, file_new, 0.8, 0, 1, 1, '', 0, 1, 0, 0)
    pdb.gimp_image_delete(image)

args = [(PF_STRING, 'file', 'GlobPattern', '*.*')]
register('python-flip', '', '', '', '', '', '', '', args, [], flip)

main()
if gimpfu:
    gimpfu.register(
        'python_fu_colourwheel_analysis',
        'Display colour distribution on a colour wheel.',
        'Display colour distribution on a colour wheel.',
        'Rebecca Breu',
        '2016 Rebecca Breu, GPLv3',
        '10 March 2016',
        '<Image>/Colors/Info/Colour Wheel Analysis...',

    'RGB*',
        [
            (gimpfu.PF_INT,
             'threshold',
             'Min. number of occurences per colour',
             1),
            (gimpfu.PF_RADIO,
             'draw_as',
             'Draw colours as',
             'cross',
             (('Single pixels', 'pixel'),
              ('Crosses', 'cross'),
              ('Squares', 'square')),
             )
        ],
        [],
        python_colourwheel_analysis,
    )

    gimpfu.main()
Ejemplo n.º 10
0
        image = image.convert('LA').convert('RGB')
    return image

def init_sstv(mode, image, vox, fskid):
    s = mode(image, 44100, 16)
    s.vox_enabled = vox
    if fskid:
        s.add_fskid_text(fskid)
    return s

register(
        "pysstv_for_gimp",
        "PySSTV for GIMP",
        "Transmits the current image using PySSTV",
        "Andras Veres-Szentkiralyi",
        "Andras Veres-Szentkiralyi",
        "November 2013",
        "<Image>/PySSTV/Transmit...",
        "*",
        [
            (PF_RADIO, "mode", "SSTV mode", "MartinM1",
                tuple((n, n) for n in sorted(MODULE_MAP.iterkeys()))),
            (PF_BOOL, "vox", "Include VOX tones", True),
            (PF_STRING, "fskid", "FSK ID", ""),
        ],
        [],
        transmit_current_image
        )

main()
Ejemplo n.º 11
0
        )

gimpfu.register(
    # name
    "spine-export",
    # blurb
    "Spine export",
    # help
    "Exports layers to images and outputs a Spine JSON file",
    # author
    "Carlo Cabanilla",
    # copyright
    "Carlo Cabanilla",
    # date
    "2014",
    # menupath
    "<Image>/File/Export/Export to Spine",
    # imagetypes
    "*",
    # params
    [
        (gimpfu.PF_ADJUSTMENT, "compression", "PNG Compression level:", 0, (0, 9, 1)),
        (gimpfu.PF_DIRNAME, "dir", "Directory", "/tmp")
    ],
    # results
    [],
    # function
    spine_export
)

gimpfu.main()
Ejemplo n.º 12
0
            output += array2struct(pr[i,j]) + ","
            i+=1
        output += array2struct(pr[i,j]) #the last column, no comma
        output += "\n};"
        savefile = open(filename,"w")
        savefile.write(output)
        savefile.close() 
    else:
        gimp.message("Error: No color mode selected")#will hardly happen as we now have a default colormode   
  
    
register(
        "export-C-code",
        "Saves the image data for LCD C programming",
        "Saveimage data for LCD C programming",
        "David Muriuki Karibe",
        "David Muriuki Karibe",
        "2015",
        "export C code",
        "RGB*, GRAY*",
        [
         (PF_IMAGE, "timg", "Input image", None),
         (PF_DRAWABLE, "tdrawable", "Input drawable", None),
         (PF_STRING, "iconname", "Icon variable name","icon"),
         (PF_STRING,"filename","file to save code to","untitled.c"),
         (PF_OPTION,"colormode","RGB Color Mode",1,("12-bit(4-4-4): not implemented","16-bit(5-6-5)", "18-bit(6-6-6): not implemented","24-bit(8-8-8)"))
        ],
        [],#no return params from the plugin function
        exportCcode, menu="<Image>/File/Export/")

main()
Ejemplo n.º 13
0
#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import pdb, main, register, PF_STRING


def despeckle(fin, fout):
    image = pdb.gimp_file_load(fin, fin)
    drawable = pdb.gimp_image_get_active_layer(image)
    pdb.plug_in_despeckle(image, drawable, 3, 1, 7, 248)
    pdb.gimp_file_save(image, drawable, fout, fout)
    pdb.gimp_image_delete(image)

args = [(PF_STRING, 'file', 'GlobPattern', '*.*'),
        (PF_STRING, 'file', 'GlobPattern', '*.*')]
register('python_despeckle', '', '', '', '', '', '', '', args, [], despeckle)

main()
        # Should really do corners here too
        # but the lack of them doesn't seem
        # to be hurting the visual quality
        synth_image(a)

import gimpfu

gimpfu.register(
    "plugin_resynth_tileset_generate",
    "Generates an output map suitable for use with plugin-resynth-tileset",
    "Generates an output map suitable for use with plugin-resynth-tileset",
    "Adam Newgas",
    "Adam Newgas",
    "2013",
    "<Toolbox>/Filters/Tileset/Generate Resynth Tileset Output Map",
    "",
    [
        (gimpfu.PF_INT, "tile_width", "Tile Width", 32),
        (gimpfu.PF_INT, "inset", "Inset", 5),
        (gimpfu.PF_FLOAT, "outer_radius", "Outer Radius", 0),
        (gimpfu.PF_FLOAT, "inner_radius", "Inner Radius", 0),
        ],
    [],
    make_blob_output_pattern,
)
gimpfu.register(
    "plugin_resynth_tileset",
    "Creates a tileset using Resynthesizer",
    "Transfers a source texture from the source map to tileable texture sheet.",
    "Adam Newgas",
    "Adam Newgas",
    "2013",
Ejemplo n.º 15
0
register(
    "python_fu_ui_options",
    "Show all Python-Fu UI options",
    "Longer description of doing stuff",
    "Your Name",
    "Your Name",
    "2010",
    "Show UI Options...",
    "",      # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
    [
        (PF_INT, "number", "Number?", 50),
        (PF_FLOAT, "angle", "Angle", 3.14159),
        # you can also use PF_INT8, PF_INT16, PF_INT32
        (PF_STRING, "word", "Word", "Zebrafish!"),
        # PF_VALUE is another term for PF_STRING
        (PF_TEXT, "text", "Some Text",
          "The quick red fox jumped over the lazy dog"),

        (PF_COLOR, "bg-color", "Background", (1.0, 1.0, 1.0)),
        # or you can spell it PF_COLOUR

        (PF_IMAGE, "image", "Input image", None),
        (PF_LAYER, "layer", "Input layer", None),
        (PF_CHANNEL, "channel", "Which channel", None),
        (PF_DRAWABLE, "drawable", "Input drawable", None),

        (PF_TOGGLE, "shadow", "Shadow?", 1),
        (PF_BOOL,   "ascending", "_Ascending", True),
        (PF_RADIO, "imagefmt", "Image format", "jpg",
          (("png", "png"), ("jpg", "jpg"))),
        (PF_OPTION, "option", "Option", 2, ("Mouse", "Cat", "Dog", "Horse")),

        (PF_SPINNER, "size", "Pixel Size", 50, (1, 8000, 1)),
        (PF_SLIDER, "opacity",  "Op_acity", 100, (0, 100, 1)),
        # (PF_ADJUSTMENT is the same as PF_SPINNER

        (PF_FILE, "imagefile", "Image file", ""),
        (PF_DIRNAME, "dire", "Directory", "/tmp"),

        (PF_FONT, "font", "Font", "Sans"),
        (PF_BRUSH, "brush", "Brush", None),
        (PF_PATTERN, "pattern", "Pattern", None),
        (PF_GRADIENT, "gradient", "Gradient", None),
        (PF_PALETTE, "palette",  "Palette", ""),

        # New items that don't quite work yet:
        #(PF_VECTORS, "vectors", "Vectors", None),
        #(PF_DISPLAY, "display", "Display", None),
    ],
    [],
    show_py_ui, menu="<Image>/Filters/Languages/Python-Fu" )
    gimpfu.gimp.progress_update(1)
    gimpfu.gimp.Display(out_img)
    gimpfu.gimp.displays_flush()


if gimpfu:
    gimpfu.register(
        'python_fu_colourwheel_analysis',
        'Display colour distribution on a colour wheel.',
        'Display colour distribution on a colour wheel.',
        'Rebecca Breu',
        '2016 Rebecca Breu, GPLv3',
        '10 March 2016',
        '<Image>/Colors/Info/Colour Wheel Analysis...',
        'RGB*',
        [(gimpfu.PF_INT, 'threshold', 'Min. number of occurences per colour',
          1),
         (
             gimpfu.PF_RADIO,
             'draw_as',
             'Draw colours as',
             'cross',
             (('Single pixels', 'pixel'), ('Crosses', 'cross'),
              ('Squares', 'square')),
         )],
        [],
        python_colourwheel_analysis,
    )

    gimpfu.main()
        raise err


def register_load_handlers():
    gimp.register_load_handler('file-lepton-load', 'lep,lepton', '')
    pdb['gimp-register-file-handler-mime']('file-lepton-load', 'image/lepton')


register(
    "file-lepton-load",
    "Open Dropbox Lepton Files",
    "Open Dropbox Lepton Files",
    "JFM",
    "Open source (BSD 3-clause license)",
    "2013",
    "Lepton",
    None,  # image type
    [
        (PF_STRING, "filename", "File to open", None),
        (PF_STRING, "raw-filename", "Name entered", None),
    ],
    [
        (PF_IMAGE, 'image', 'Output image'),
    ],
    file_load_lepton,
    on_query=register_load_handlers,
    menu="<Load>",
)

main()
Ejemplo n.º 18
0
# Initialization
gimpfu.register(
    # name
    "ora-plus",
    # blurb
    "OpenRaster Plus exporter",
    # help
    "Exports layers and paths to OpenRaster compatible file with extra metadata useful for importing into other systems, like games.",
    # author
    "Carlo Cabanilla",
    # copyright
    "Carlo Cabanilla",
    # date
    "2014",
    # menupath
    "<Image>/File/Export/Export as OpenRaster Plus",
    # imagetypes
    "*",
    # params
    [
        (gimpfu.PF_ADJUSTMENT, "compression", "PNG Compression level:", 0, (0, 9, 1)),
        (gimpfu.PF_DIRNAME, "dir", "Directory", os.getcwd()),
        (gimpfu.PF_BOOL, "should_merge", "Merge layer groups?", True),
        (gimpfu.PF_BOOL, "should_zip", "Zip to .ora?", False),
    ],
    # results
    [],
    # function
    ora_plus
)
Ejemplo n.º 19
0
    f = tempfile.NamedTemporaryFile(suffix=".png", delete=False)
    f.close()
    pdb.file_png_save(img, layer, f.name, f.name, 0, 9, 0, 0, 0, 0, 0)
    data = open(f.name, "rb").read()
    os.unlink(f.name)
    # send to GauGAN API
    gaugan = GauganAPI()
    jpg = gaugan.convert(data, style)
    # save result to a temporary file, because pdb cannot load from a buffer
    f = tempfile.NamedTemporaryFile(suffix=".jpg", delete=False)
    f.close()
    open(f.name, "wb").write(jpg)
    # open the temp file
    image = pdb.gimp_file_load(f.name, f.name)
    # copy the first layer to clipboard
    pdb.gimp_edit_copy(image.layers[0])
    os.unlink(f.name)
    # paste clipboard contents as a floating selection
    floating = pdb.gimp_edit_paste(layer, 0)
    floating.name = layer.name + " [GauGAN]"


register("python_fu_gaugan", "Process the selected layer in GauGAN",
         "Process the selected layer in GauGAN",
         "Pavol Rusnak <*****@*****.**>", "MIT License", "2019",
         "<Image>/Filters/GauGAN...", "RGB*", [
             (PF_STRING, "style", "style", "random"),
         ], [], python_gaugan)

main()
Ejemplo n.º 20
0
                                    PNG_GAMA,
                                    PNG_OFFSET,
                                    PNG_PHYS,
                                    PNG_TIME,
                                    PNG_COMMENT,
                                    PNG_SVGTRANS)

            else:
                return SystemExit("Image extension %r is not supported!"
                                  % CAPTCHA_FILE_EXT)
        except Exception as err:
            print(err)
            if os.path.isfile(imageTmp):
                os.unlink(imageTmp)
        else:
            os.rename(imageTmp, imagePath)


# Gimp-python boilerplate.
gimpfu.register('captcha_generate',
                'Generate CAPTCHAs',
                'Generate CAPTCHAs',
                'Isis Lovecruft',
                'Isis Lovecruft',
                '2014',
                '<Toolbox>/Xtns/Make-Captcha', '',
                [(gimpfu.PF_STRING, 'basedir', 'base directory for images', ''),
                 (gimpfu.PF_INT, 'count', 'number of images to add', 0)],
                [], captcha_generate)
gimpfu.main()
Ejemplo n.º 21
0
def register_save_handlers():
    gimp.register_save_handler('file-wavefile-save', 'wav', '')


###############################################################################
# Save
gimpfu.register(
    "file-wavefile-save",
    "Saves the image as a wavefile (.wav)",  # Description
    "Saves the image as a wavefile (.wav)",
    "Nick Hilton",  # Author
    "Nick Hilton",  # Copyright
    "2010",  # Year
    "Wavefile",
    "*",
    [  #input args. Format (type, name, description, default [, extra])
        (gimpfu.PF_IMAGE, "img", "Input image", None),
        (gimpfu.PF_DRAWABLE, "layer", "Input drawable", None),
        (gimpfu.PF_STRING, "filename", "The name of the file", None),
        (gimpfu.PF_STRING, "raw_filename", "The name of the file", None),
    ],
    [],  #results. Format (type, name, description)
    save_wavefile,
    on_query=register_save_handlers,
    menu="<Save>",
    domain=("gimp20-python", gimp.locale_directory))

###############################################################################
# Load
gimpfu.register(
    "file-wavefile-load",  # Name
    "Loads wavefile (.wav) as an image",  # Description
Ejemplo n.º 22
0
    print "Instantiating server..."
    remote_gimp = Pyro3Server()

    # Bypass NS
    # proxy = Pyro.core.getProxyForURI('PYROLOC://hostname:port/objectname')
    print "Pyro.core.initServer()..."
    Pyro.core.initServer()
    print "Instantiating daemon..."
    daemon = Pyro.core.Daemon(host="localhost", port=16319)
    daemon.connect(remote_gimp, 'remote_gimp')
    print "Entering loop..."
    daemon.requestLoop()

# This is the plugin registration function
# I have written each of its parameters on a different line
register(# @UndefinedVariable
    "pyro2gimp",
    "Launches a PyRO server",
    "Launches a PyRO (Python Remote Objects) server to access Gimp internals",
    "Horacio G. de Oro",
    "Horacio G. de Oro",
    "December 2013",
    "<Image>/Filters/Python-Fu/PyRO Server",
    "*",
    [],
    [],
    start_pyro3_server,
    )

main()  # @UndefinedVariable
Ejemplo n.º 23
0
        
    # Show warning message
    if warnings: 
        warnings.append(UPSCALE_WARN_MESSAGE)
        gimp.message('\n'.join(warnings))

gimpfu.register("python_fu_android_xdpi", 
                "Write Android drawables for all DPI folders", 
                "Write images for all android densities", 
                "Nic", "Nicolas CORNETTE", "2012", 
                "<Image>/Filters/Android/Write Android XDPIs...", 
                "*", [
                    (gimpfu.PF_DIRNAME, "res-folder",     "Project res Folder", DEFAULT_OUTPUT_DIR), #os.getcwd()),
                    (gimpfu.PF_RADIO, "folder-prefix", "Android Folder Prefix", DEFAULT_FOLDER_PREFIX, (("drawable", "drawable"), ("mipmap", "mipmap"))),
                    (gimpfu.PF_STRING, "image-basename", "Image Base Name", 'icon'),
                    (gimpfu.PF_SPINNER, "target-width", "Target DP Width", 48, (1, 8000, 2)),
                    (gimpfu.PF_BOOL, "x_ldpi",    "  Export ldpi",   False),
                    (gimpfu.PF_BOOL, "x_mdpi",    "  Export mdpi",   True),
                    (gimpfu.PF_BOOL, "x_hdpi",    "  Export hdpi",   True),
                    (gimpfu.PF_BOOL, "x_xhdpi",   "  Export xhdpi",  True),
                    (gimpfu.PF_BOOL, "x_xxhdpi",  "  Export xxhdpi", True),
                    (gimpfu.PF_BOOL, "x_xxxhdpi", "  Export xxxhdpi",False),
                    #(gimpfu.PF_BOOL, "x_tvdpi",   "  Export tvdpi",  False),
                    (gimpfu.PF_BOOL, "allow_upscale", "  Create upscaled images", False),
                    (gimpfu.PF_RADIO, "image-extension", "Image Format", DEFAULT_OUTPUT_EXT, (("gif", "gif"), ("png", "png"), ("jpg", "jpg"))),
                      ], 
                [], 
                write_xdpi) #, menu, domain, on_query, on_run)

gimpfu.main()
Ejemplo n.º 24
0
        pdb.gimp_message(msg)
        pyperclip.setcb(msg)


def print_selection_bounds_halfsize(image, drawable):
    print_selection_bounds(image, drawable, halfsize=True)


gimpfu.register(
            "print_selection_bounds",
            "CGRect pretty-printer",
            "This script does almost nothing and is extremely good at it",
            "divanov",
            "",
            "Apr 2012",
            "<Image>/Tools/Copy CGRect to clipboard",
            "*",
            [],
            [],
            print_selection_bounds,
        )


gimpfu.register(
            "print_selection_bounds_halfsize",
            "CGRect pretty-printer",
            "This script does almost nothing and is extremely good at it",
            "divanov",
            "",
            "Apr 2012",
            True,  # time
        )
        gimp.message("All frames saved as {}".format(file_path))
    finally:
        pdb.gimp_image_delete(sheet)


gimpfu.register(
    "python_animation_helper_stack",
    "Stack all layers from all other images onto the current image",
    "Plugin to stack all layers from all other images onto the current image.",
    "Anthony Hayward",
    "Anthony Hayward 2020.  LGPL License",
    "2020",
    "Stack all images onto this one",
    "*",
    # input parameters. Same count and order as for plugin_func parameters
    [
        (gimpfu.PF_IMAGE, "target", "Image to modify",
         None),  # type, name, description, default
    ],
    [],
    stack,
    menu="<Image>/Filters/Animation",
)

gimpfu.register(
    "python_animation_helper_bc",
    r"Adjust brightness and contrast on all layers.",
    "Plugin to increase contrast on all layers of the current image.",
    "Anthony Hayward",
    "Anthony Hayward 2020.  LGPL License",
                            file_h.write(line.replace('_', prefix+'_'))
                    else:
                        file_h.write(line)
                file_h.truncate()

        pdb.gimp_image_delete(image)

        # necessary ?
        pdb.gimp_context_pop()

register(
    "create_base_alphabet",
    "Create the base alphabet XBMs for a given font/size",
    "Create the base alphabet XBMs for a given font/size",
    "WanderingGlitch",
    "WanderingGlitch",
    "2016",
    "Create base alphabet",
    "",
    [
        (PF_FONT, "font", "Font face", "Ariel"),
        (PF_SPINNER, "font_size", "Font Size", 18, (10, 100, 1)),
        (PF_STRING, "string", "Directory base", ""),
    ],
    [],
    create_base_alphabet, 
)

main()

Ejemplo n.º 27
0
register(
    "python_fu_ui_options",
    "Show all Python-Fu UI options",
    "Longer description of doing stuff",
    "Your Name",
    "Your Name",
    "2010",
    "Show UI Options...",
    "",  # Alternately use RGB, RGB*, GRAY*, INDEXED etc.
    [
        (PF_INT, "number", "Number?", 50),
        (PF_FLOAT, "angle", "Angle", 3.14159),
        # you can also use PF_INT8, PF_INT16, PF_INT32
        (PF_STRING, "word", "Word", "Zebrafish!"),
        # PF_VALUE is another term for PF_STRING
        (PF_TEXT, "text", "Some Text",
         "The quick red fox jumped over the lazy dog"),
        (PF_COLOR, "bg-color", "Background", (1.0, 1.0, 1.0)),
        # or you can spell it PF_COLOUR
        (PF_IMAGE, "image", "Input image", None),
        (PF_LAYER, "layer", "Input layer", None),
        (PF_CHANNEL, "channel", "Which channel", None),
        (PF_DRAWABLE, "drawable", "Input drawable", None),
        (PF_TOGGLE, "shadow", "Shadow?", 1),
        (PF_BOOL, "ascending", "_Ascending", True),
        (PF_RADIO, "imagefmt", "Image format", "jpg", (("png", "png"),
                                                       ("jpg", "jpg"))),
        (PF_OPTION, "option", "Option", 2, ("Mouse", "Cat", "Dog", "Horse")),
        (PF_SPINNER, "size", "Pixel Size", 50, (1, 8000, 1)),
        (PF_SLIDER, "opacity", "Op_acity", 100, (0, 100, 1)),
        # (PF_ADJUSTMENT is the same as PF_SPINNER
        (PF_FILE, "imagefile", "Image file", ""),
        (PF_DIRNAME, "dire", "Directory", "/tmp"),
        (PF_FONT, "font", "Font", "Sans"),
        (PF_BRUSH, "brush", "Brush", None),
        (PF_PATTERN, "pattern", "Pattern", None),
        (PF_GRADIENT, "gradient", "Gradient", None),
        (PF_PALETTE, "palette", "Palette", ""),

        # New items that don't quite work yet:
        #(PF_VECTORS, "vectors", "Vectors", None),
        #(PF_DISPLAY, "display", "Display", None),
    ],
    [],
    show_py_ui,
    menu="<Image>/Filters/Languages/Python-Fu")
    try:
        pdb
        interactive = False
    except NameError, e:
        interactive = True
    
    if not interactive:
        xcf_path = os.environ.get('XCF_FILE')
        if xcf_path:
            png_path = os.path.splitext(xcf_path)[0]
            image = pdb.gimp_xcf_load(0, xcf_path, xcf_path)
            extract_layers(image, None, png_path)

    else:
        import gimpfu
        pdb = gimpfu.pdb
        DEFAULT_OUTPUT_DIR = os.getcwd()
        gimpfu.register("python_fu_extract", 
                        "Extract Layers", 
                        "Save coordinates to json file", 
                        "Nic", "Nicolas CORNETTE", "2014", 
                        "<Image>/File/Export/Export Emulator Skin...", 
                        "*", [
                            (gimpfu.PF_DIRNAME, "save-path", "Path for export", DEFAULT_OUTPUT_DIR),
                              ], 
                        [], 
                        extract_layers) #, menu, domain, on_query, on_run)
        gimpfu.main()

Ejemplo n.º 29
0
        pdb.gimp_message(msg)
        pyperclip.setcb(msg)


def print_selection_bounds_halfsize(image, drawable):
    print_selection_bounds(image, drawable, halfsize=True)


gimpfu.register(
    "print_selection_bounds",
    "CGRect pretty-printer",
    "This script does almost nothing and is extremely good at it",
    "divanov",
    "",
    "Apr 2012",
    "<Image>/Tools/Copy CGRect to clipboard",
    "*",
    [],
    [],
    print_selection_bounds,
)

gimpfu.register(
    "print_selection_bounds_halfsize",
    "CGRect pretty-printer",
    "This script does almost nothing and is extremely good at it",
    "divanov",
    "",
    "Apr 2012",
    "<Image>/Tools/Copy CGRect to clipboard (halfsize)",
Ejemplo n.º 30
0
    pdb.gimp_selection_none(image)

    pdb.gimp_image_undo_group_end(image)
    pdb.gimp_context_pop()

    pdb.gimp_displays_flush()


gimpfu.register(
    "python_stickerify_bordure",
    "Put a sticker bordure arround the current layer",
    "Put a sticker bordure arround the current layer",
    "Laurent Peuch",
    "Laurent Peuch",
    "2018",
    "<Image>/Filters/Artistic/Stickerify",
    "",
    [
        (gimpfu.PF_TOGGLE, "resize", "Resize/fit into 512x512", False),
        (gimpfu.PF_ADJUSTMENT, "black_grow", "Size of black bordure (px)", 3, (0, 200, 1, 3, 0, 0)),
        (gimpfu.PF_ADJUSTMENT, "white_grow", "Size of white bordure (px)", 12, (0, 200, 1, 3, 0, 0)),
        (gimpfu.PF_TOGGLE, "shadow", "Display shadow", True),
        (gimpfu.PF_ADJUSTMENT, "canvas_increase", "Increase canvas size (in %)", 0, (0, 100, 1, 3, 0, 0)),
    ],
    [],
    stickerify_bordure,
)

gimpfu.main()
Ejemplo n.º 31
0
    b64 = base64.b64encode(data)
    os.unlink(f.name)
    # send data to Runway via a POST request
    data = json.dumps({"semantic_map": b64})
    req = urllib2.Request("http://*****:*****@rusnak.io>", "MIT License", "2019",
         "<Image>/Filters/Runway...", "RGB*", [], [], python_runway)

main()
Ejemplo n.º 32
0
            pdb.gimp_image_remove_layer(
                sel_image, sel_image.layers[-1])  # Remove original layer
            pdb.file_tiff_save(sel_image, sel_layer, self.pathfileImageSelect,
                               '', 0)
        else:
            pdb.file_tiff_save(sel_image, channel, self.pathfileImageSelect,
                               "", 0)
        #
        pdb.gimp_image_delete(sel_image)
        data = {'isOk': True, 'ulPixelSelect': {'X': x1, 'Y': y1}}
        data.update(self.paramImage)
        socket.send(json.dumps(data))


def run():
    if gimp_shelf.has_key('socket_server') and gimp_shelf['socket_server']:
        msg = "WARNING: '{}' is already running!".format(Service.titleServer)
        Service.printMessage(msg)
        return

    serv = Service()
    serv.run()
    del serv


register("python_fu_socket_server", Service.titleServer, Service.titleServer,
         "Luiz Motta", "IBAMA", "2016",
         "<Toolbox>/IBAMA/{}".format(Service.titleServer), "", [], [], run)

main()
Ejemplo n.º 33
0
    """ Prepare a folder of images for DriveThruCards printing.
    """
    gimp.progress_init(
        'Prepare a folder of images for DriveThruCards printing...')
    _iterate_folder(input_folder, output_folder, prepare_drivethrucards)


register(
    'python_prepare_pdf_front',
    'Prepare a front image for PDF document',
    '1. Rotate a landscape image. 2. Add white bleed margins. 3. Export PNG.',
    'A.R.',
    'A.R.',
    '2020',
    'Prepare PDF Front',
    '*',
    [
        (PF_IMAGE, 'image', 'Input image', None),
        (PF_DRAWABLE, 'drawable', 'Input drawable', None),
        (PF_DIRNAME, 'output_folder', 'Output folder', None)
    ],
    [],
    prepare_pdf_front,
    menu='<Image>/Filters')

register(
    'python_prepare_pdf_front_folder',
    'Prepare a folder of front images for PDF document',
    '1. Rotate a landscape image. 2. Add white bleed margins. 3. Export PNG.',
    'A.R.',
    'A.R.',
Ejemplo n.º 34
0
   	Normal:      0  52  87 116 144 172 206 255
   	Shadow:      0  29  52  70  87 101 116 130
   	Highlight: 130 144 158 172 187 206 228 255'''

register(
    "python-fu-mega-drive-colors",
    mdcolors_desc + mdcolor_info,
    mdcolors_desc + mdcolor_info,
    "Flamewing",
    "Flamewing",
    "2013-2021",
    "Fix Colors...",
    "RGB*, GRAY*, INDEXED*", [
        (PF_IMAGE, "image", "Input image", None),
        (PF_DRAWABLE, "layer", "Input layer", None),
        (PF_RADIO, "srcmode", "Assume source is close to:",
         ColorMode.SKCollect, (("SonMapEd colors", ColorMode.SonMapEd),
                               ("S&KC colors", ColorMode.SKCollect),
                               ("VDP measurements", ColorMode.Measured))),
        (PF_RADIO, "dstmode", "Destination should use:", ColorMode.SKCollect,
         (("SonMapEd colors", ColorMode.SonMapEd),
          ("S&KC colors", ColorMode.SKCollect),
          ("VDP measurements", ColorMode.Measured))),
        (PF_BOOL, "shlmode", "Allow shadow/highlight colors:", False),
    ], [],
    MDColors,
    menu="<Image>/Filters/Mega Drive")

register(
    "python-fu-mega-drive-fade",
    mdfader_desc + mdcolor_info,
Ejemplo n.º 35
0
    # layer_group = pdb.gimp_layer_group_new(image)
    layer_group=pdb.gimp_item_get_parent(image.layers[0])
    layer=pdb.gimp_file_load_layer(image, file)
    pdb.gimp_image_insert_layer(image,layer,layer_group,1)#(image, layer, parent, position)
    for layer in image.layers:
      pdb.gimp_item_set_visible(layer,True)
    layer = pdb.gimp_image_merge_visible_layers(image, 0)
    pdb.gimp_image_set_active_layer(image, layer)
    drawable = pdb.gimp_image_get_active_layer(image)
    # with open("E:/out.txt",'w') as outTxt:
    #   outTxt.write(outFile)
    pdb.file_dds_save(image, drawable, outFile,outFile,0,0,0,0,0,0,0)
    # pdb.gimp_file_save(image, drawable, outFile+".xcf",outFile+".xcf")
    # break


args = [
(PF_FILE , 'file', 'Background file', '.'),
(PF_STRING , 'folder', 'Icon folder', '.'),
(PF_STRING , 'outFolder', 'Output folder', '.'),
(PF_INT , 'scaleTo', 'Pixel Number', 54)
]
#register('layertodds', "Saves layers to dds","Saves layers to dds","Gratak","Gratak",2017,"<Image>/Image/Save to dds", "RGB*, GRAY*",
# [
#                 (PF_INT, "max_width", "Maximum Width", 500),
#                 (PF_INT, "max_height", "Maximum Height", 500),
#                 (PF_BOOL, "copy", "Make a JPEG copy", TRUE),
#         ], layerToDDS)
register('createTechIcons', "Create Tech Icons","Create Tech Icons","Gratak","Gratak","2017","<Image>/Image/Create Tech Icons",'', args, [], createTechIcons)

main()
Ejemplo n.º 36
0
gimpfu.register(
    "photo-cutter",
    "Cut out photos from scanned image",
    "Find and cut out parts of an image. Will also try to deskew them (deskew plugin required). "\
        "Useful for multiple photos scanned at once.",
    "Dmitriy Geels", "Dmitriy Geels", "2018",
    "_Cut out photos",
    "RGB*,GRAY*", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
    [ # pylint: disable=C0301,C0326
        (gimpfu.PF_IMAGE,    "image",        "Current image",            None),
        (gimpfu.PF_DRAWABLE, "drawable",     "Input layer",              None),
        (gimpfu.PF_SPINNER,  "limit",        "Max number of items",      10, (1, 100, 1)),
        (gimpfu.PF_SPINNER,  "sl_thresh",    "Selection Threshold",      25, (0, 255, 1)),
        (gimpfu.PF_SPINNER,  "sz_thresh",    "Size Threshold",           100, (0, 2000, 10)),
        (gimpfu.PF_TOGGLE,   "bg_manual",    "Manually set background colour", False),
        (gimpfu.PF_COLOR,    "bg_color",     "Pick background colour",   (255, 255, 255)),
        (gimpfu.PF_OPTION,   "bg_corner",    "Auto-background sample corner", 0, ("Top Left", "Top Right", "Bottom Left", "Bottom Right")),
        (gimpfu.PF_SPINNER,  "bg_x",         "Auto-background sample x-offset", 25, (5, 100, 1)),
        (gimpfu.PF_SPINNER,  "bg_y",         "Auto-background sample y-offset", 25, (5, 100, 1)),
        (gimpfu.PF_SPINNER,  "padding",      "Draw border (px)",         0, (0, 100, 1)),
        (gimpfu.PF_TOGGLE,   "deskew",       "Run Deskew plugin if available", True),
        (gimpfu.PF_TOGGLE,   "sq_crop",      "Force square crop",        False),
        (gimpfu.PF_TOGGLE,   "autoclose",    "Autoclose sub-images",     True),
        (gimpfu.PF_TOGGLE,   "save_same",    "Save output to the same directory", True),
        (gimpfu.PF_DIRNAME,  "save_dir",     "Target directory (if not same)", ""),
        (gimpfu.PF_OPTION,   "save_ftype",   "Save File Type",           0, ("jpg", "png", "tiff")),
        (gimpfu.PF_SPINNER,  "save_dpi",     "Save DPI",                 300, (0, 1200, 10)),
        (gimpfu.PF_SPINNER,  "jpg_qual",     "JPG Quality",              0.8, (0.1, 1.0, 0.05)),
        (gimpfu.PF_STRING,   "save_suffix",  "Save File suffix",         "Crop")
    ], # pylint: enable=C0301,C0326
    [
        (gimpfu.PF_INT, 'extracted', 'extracted images count')
    ],
    cutter_single_image,
    menu="<Image>/Tools/Scan c_utter")  # second item is menu location
Ejemplo n.º 37
0
#

import gimpfu
import gimp
import time


def hello():
    """Mostra a mensagem Olá Mundo! na barra de progresso"""
    gimp.progress_init("Olá Mundo")
    for i in range(100):
        gimp.progress_update(i / 100.)
        time.sleep(.25)


gimpfu.register(
    "hello-tutorial",  # name
    "Olá Mundo na barra de progresso",  # blurb
    "Mostra o texto 'Olá Mundo' na barra de progresso",  # help
    "Alexandre Machado",  # author
    "Alexandre Machado",  # copyright
    "2017",  # date
    "<Toolbox>/_Tutorial/_Olá Mundo",
    "",  # imagetypes
    [],  # params
    [],  # results
    hello,  # function
)

gimpfu.main()
            new_img, new_width, new_height, gimpfu.INTERPOLATION_CUBIC)
        
        gimpfu.pdb.gimp_file_save( #@UndefinedVariable
            new_img, new_img.layers[0], target_res_filename, target_res_filename)
        
        gimpfu.pdb.gimp_image_delete(new_img) #@UndefinedVariable
        
    # Show warning message
    if warnings: 
        warnings.append(UPSCALE_WARN_MESSAGE)
        gimp.message('\n'.join(warnings))

gimpfu.register("python_fu_android_xdpi", 
                "Write Android drawables for all DPI folders", 
                "Write images for all android densities", 
                "Nic", "Nicolas CORNETTE", "2012", 
                "<Image>/Filters/Android/Write Android XDPIs...", 
                "*", [
#                    (gimpfu.PF_IMAGE, "image", "Input image", None),
#                    (gimpfu.PF_DRAWABLE, "drawable", "Input drawable", None),
                    (gimpfu.PF_DIRNAME, "res-folder",     "Project res Folder", DEFAULT_OUTPUT_DIR), #os.getcwd()),
                    (gimpfu.PF_STRING, "image-basename", "Image Base Name", 'icon'),
                    (gimpfu.PF_INT, "target-width", "Target Width", 48),
                    (gimpfu.PF_RADIO, "target-dpi", "Base Density", DEFAULT_OUTPUT_DPI, (("ldpi", "drawable-ldpi"), ("mdpi", "drawable-mdpi"), ("hdpi", "drawable-hdpi"), ("xhdpi", "drawable-xhdpi"))),
                    (gimpfu.PF_RADIO, "image-extension", "Image Format", DEFAULT_OUTPUT_EXT, (("gif", "gif"), ("png", "png"), ("jpg", "jpg"))),
                      ], 
                [], 
                write_xdpi) #, menu, domain, on_query, on_run)

gimpfu.main()
Ejemplo n.º 39
0
        yield "(disabled)", None
        for port, desc, _ in comports():
            yield '{0} ({1})'.format(port, desc.strip()), port


register(
        "pysstv_for_gimp",
        "PySSTV for GIMP",
        "Transmits the current image using PySSTV",
        "Andras Veres-Szentkiralyi",
        "Andras Veres-Szentkiralyi",
        "November 2013",
        "<Image>/PySSTV/Transmit...",
        "*",
        [
            (PF_RADIO, "mode", "SSTV mode", "MartinM1",
                tuple((n, n) for n in sorted(MODULE_MAP.iterkeys()))),
            (PF_BOOL, "vox", "Include VOX tones", True),
            (PF_STRING, "fskid", "FSK ID", ""),
            (PF_RADIO, "ptt_port", "PTT port", None,
                tuple(get_serial_ports())),
            (PF_RADIO, "ptt_pin", "PTT pin", "RTS",
                tuple((n, n) for n in ("RTS", "DTR"))),
            (PF_BOOL, "ptt_state", "PTT inversion", False),
        ],
        [],
        transmit_current_image
        )

main()
Ejemplo n.º 40
0
    _iterate_folder(input_folder, output_folder, prepare_generic_png)


def prepare_tts_folder(input_folder, output_folder):
    """ Prepare a folder of TTS sheet images.
    """
    gimp.progress_init('Prepare a folder of TTS sheet images...')
    _iterate_folder(input_folder, output_folder, prepare_tts)


register('python_cut_bleed_margins',
         'Cut bleed margins from an image',
         '1. Cut bleed margins. 2. Export PNG.',
         'A.R.',
         'A.R.',
         '2020',
         'Cut Bleed Margins',
         '*', [(PF_IMAGE, 'image', 'Input image', None),
               (PF_DRAWABLE, 'drawable', 'Input drawable', None),
               (PF_DIRNAME, 'output_folder', 'Output folder', None)], [],
         cut_bleed_margins,
         menu='<Image>/Filters')

register('python_cut_bleed_margins_folder',
         'Cut bleed margins from a folder of images',
         '1. Cut bleed margins. 2. Export PNG.',
         'A.R.',
         'A.R.',
         '2020',
         'Cut Bleed Margins Folder',
         '*', [(PF_DIRNAME, 'input_folder', 'Input folder', None),
               (PF_DIRNAME, 'output_folder', 'Output folder', None)], [],
Ejemplo n.º 41
0
    return num_progress_items


#===============================================================================

gimpfu.register(
    proc_name="generate_predefined_completions_for_pydev",
    blurb=("Generate predefined completions for GIMP modules for PyDev "
           "(Eclipse IDE plug-in)"),
    help=(
        'This plug-in generates separate .pypredef files for each module and '
        'for the GIMP procedural database in the "{0}" subdirectory '
        'of the directory where this plug-in is located.'.format(
            pypredefgen.PYPREDEF_FILES_DIRNAME)),
    author="khalim19",
    copyright="",
    date="",
    label="Generate Predefined Completions for PyDev",
    imagetypes="",
    params=[(gimpfu.PF_BOOL, "generate_for_modules",
             "Generate completions for modules?", True),
            (gimpfu.PF_BOOL, "generate_for_pdb",
             "Generate completions for GIMP procedural database (PDB)?", True)
            ],
    results=[],
    function=generate_predefined_completions_for_pydev,
    menu="<Image>/Filters/Languages/Python-Fu")

gimpfu.main()
Ejemplo n.º 42
0
    img = gimp.Image(width,height,RGB)
    lyr = gimp.Layer(img, 'layer1', width, height, RGB, 100, NORMAL_MODE) 
    lyr.fill(BACKGROUND_FILL)
    img.add_layer(lyr)
    gimp.Display(img)
    gimp.displays_flush()
    
def createIcon(iconWidth, iconHeight):
    showWin(iconWidth,iconHeight)
    
register(
        "NewIcon",
        "Creates a new image as an LCD icon \nof a given width and height",
        "Lets create an LCD icon",
        "David Muriuki Karibe",
        "David Muriuki Karibe",
        "2015",
        "LCD Icon",#menu entry text
        "",# Create a new image, don't work on an existing one
        [
         (PF_INT, "iconWidth", "Icon Width", 21),
         (PF_INT, "iconHeight", "Icon Height", 12)#(Type, Name, Description, default, extra)
        ],
        [],
        createIcon, menu="<Image>/File/Create")#path to menu entry, under file

main()

#register(
#proc_name, blurb, help, author, copyright, date, label, imagetypes, params, results, function, menu=None, domain=None, on_query=None, on_run=None
#)
register(
	"runPlugin",                  # The name of the command.
	"Detect Faces in an Image.",  # A brief description of the command.
	"Detect Faces in an Image.",  # Help message.
	"Craig Sanders",              # Author.
	"Craig Sanders",              # Copyright holder.
	"2019",                       # Date.
	"Detect Faces",               # The way the script will be referred to in the menu.
	# "RGB*, GRAY*",              # Image mode
	"",                           # Create a new image, don't work on an existing one.
	[
		(PF_FILE,
		 "filename_input",
		 "Filename of Input Image",
		 "/home/craig/Pictures/Daddy and James.jpg"
		),
		(PF_FILE,
		 "filename_result",
		 "Filename of Resulting Image",
		 "/home/craig/Pictures/result.jpg"
		),
		(PF_FILE,
		 "filename_face_detect",
		 "Filename of Face detect Python code",
		 "/home/craig/gimp-2.8/plug-ins/FaceDetect/face_detect_cv3.py"
		),
		(PF_FILE,
		 "filename_cascade",
		 "Filename of Cascade file",
		 "/home/craig/local/source/GitHub_projects/other/FaceDetect/haarcascade_frontalface_default.xml"
		),
		(PF_RADIO,
		"filename_manipulation_method",
		"Colour for face detect rectangles",
		COLOUR_GREEN,
			(
				("Red",     "COLOUR_RED"),
				("Green",   "COLOUR_GREEN"),
				("Blue",    "COLOUR_BLUE"),
				("Cyan",    "COLOUR_CYAN"),
				("Magenta", "COLOUR_MAGENTA"),
				("Yellow",  "COLOUR_YELLOW")
			)
		)
	],
	[],
	runPlugin,
	menu="<Image>/Image/Craig's Utilities/")
gimpfu.register(
        # name
        "python-fu-mansiki-build-images-for-mq-copyprint",
        # blurb
        "python-fu mansiki-build-images-for-mq-copyprint\n漫式原稿用紙コンビニ印刷用用紙整形スクリプト\nマルチスレッド対応版",
        # help
        "experiment",
        # author
        "experiment <ryunosinfx2._{at}_.gmail.com>",
        # copyright
        "experiment",
        # date
        "2015",
        # menupath
        "<Image>/Python-Fu/MansikiBuildImagesForCopyPrintMQ",
        # imagetypes
        "",
        # params
        [
         (
            # ディレクトリ選択、 変数名、ラベル、初期値
            gimpfu.PF_DIRNAME, "target","対象格納\nディレクトリ",expanduser("~")
            )
        , (
            # ディレクトリ選択、 変数名、ラベル、初期値
            gimpfu.PF_DIRNAME, "works", "作業、結果格納\nディレクトリ", (expanduser("~")+"/tmp") 
            )
        #ページ数
        , (gimpfu.PF_INT, "dpi", "解像度dpi", 600)
        #ページ数
        , (gimpfu.PF_RADIO, "size", "印刷製本サイズ", "B5", (("A4", "A4"), ("B5", "B5"), ("A5", "A5")))
        #スタイル名
        , (gimpfu.PF_STRING, "frontPrefix", "xcf表紙接頭文字列", "Front_")
        #スタイル名
        , (gimpfu.PF_STRING, "mainPrefix", "xcf本文接頭文字列", "Main_")
        #スタイル名
        , (gimpfu.PF_STRING, "rearPrefix", "xcf裏表紙接頭文字列", "Rear_")
        , (gimpfu.PF_STRING, "finalPrefix", "最終出力品接頭文字列", "U_")
        , (gimpfu.PF_BOOL, "direction",    " ←ページ送り",   True)
        , (gimpfu.PF_BOOL, "isCutMain",    " メインページ切り取り",   True)
        , (gimpfu.PF_FLOAT, "padding",    " 余白mm",   2.64)
        , (gimpfu.PF_INT, "numWorkerThreads",    " 実行スレッド数",   2)
         ],
        # results
        [],
        # function
        mansiki_build_images_for_mq_copyprint)
Ejemplo n.º 45
0
register(
    "scale_and_set_size_interactive",  # The name of the command.
    "Scale and set an image to a particular size",  # A brief description of the command.
    "Scale and set an image to a particular size",  # Help message.
    "Craig Sanders",  # Author.
    "Craig Sanders",  # Copyright holder.
    "2018",  # Date.
    "Scale and set image size",  # The way the script will be referred to in the menu.
    "RGB*, GRAY*",  # Image mode
    [
        (PF_IMAGE, "image", "Input image", None),
        (PF_DRAWABLE, "drawable", "Input layer", None),
        (PF_INT, "horizontalResolution", "Horizontal resolution", 1920),
        (PF_INT, "verticalResolution", "Vertical resolution", 1080),
        (PF_RADIO, "scalingFactorPreference", "Scaling factor preference", 0,
         (("Use smallest scaling factor", 0),
          ("Use largest scaling factor", 1))),
        (PF_INT, "horizontalOffset", "Horizontal offset", 0),
        (PF_INT, "verticalOffset", "Vertical offset", 0),
        # (PF_INT,      "interpolationMode",    "Interpolation mode",    3),
        (PF_RADIO, "interpolationMode", "Inerpolation mode", 3,
         (("None", INTERPOLATION_NONE), ("Linear", INTERPOLATION_LINEAR),
          ("Cubic", INTERPOLATION_CUBIC),
          ("Sinc (Lanczos3)", INTERPOLATION_LANCZOS))),
        (PF_FILE, "filename",
         "Save image using a different filename.\n\n(Leave this field empty to save image\nusing the current filename.)",
         None)
    ],
    [],
    scale_and_set_size_interactive,
    menu="<Image>/Image/Craig's Utilities"
)  # The name used to refer to the action
def save_gif(layeredImage, outFilePathname, defaultDelay, Loop):
    pdb.gimp_image_convert_indexed(layeredImage, 0, 2, 0, True, True, 0)
    pdb.file_gif_save(layeredImage, None, outFilePathname, outFilePathname,
                      False, Loop, defaultDelay, 0)

register(
    'animate_bot_recording',
    'Join images into a animated gif.',
    'Create a gif image from a directory of images in alphabetical ordered.',
    'Jonathan Niehenke',
    'Jonathan Niehenke',
    '2015',
    'animate bot recording...',
    '',
    [
        (PF_DIRNAME, 'imageDirectory', 'Directory contianing the images',
            '~/Pictures/Animate/'),
        (PF_STRING, 'outFilename', 'Save image as', 'Untitled.gif'),
        (PF_OPTION, 'delayType', 'Type of Delay', 0, ['Replay', 'Fixed']),
        (PF_SLIDER, 'delayArg',
            'Replay speed (<1 is faster)\nOr Frames per Second',
            1, (0.125, 10, 0.125)),
        (PF_TOGGLE, 'Loop', 'Loop the image', True),
        ],
    [],
    animate_recording,
    menu="<Image>/File/Create",
    )

main()
Ejemplo n.º 47
0
        
        gimpfu.pdb.gimp_file_save( #@UndefinedVariable
            new_img, new_img.layers[0], target_res_filename, target_res_filename)
        
        gimpfu.pdb.gimp_image_delete(new_img) #@UndefinedVariable
        
    # Show warning message
    if warnings: 
        warnings.append(UPSCALE_WARN_MESSAGE)
        gimp.message('\n'.join(warnings))

gimpfu.register("python_fu_ios_icons",
                "Write iOS icons for all icon size",
                "Write images for all iOS sizes",
                "rebus007", "Raphael Bussa", "2017",
                "<Image>/Filters/iOS/Write iOS icons...",
                "*", [
                    (gimpfu.PF_DIRNAME, "res-folder",     "Project icons Folder", DEFAULT_OUTPUT_DIR), #os.getcwd()),
                    (gimpfu.PF_STRING, "image-basename", "Image Base Name", 'icon'),
                    (gimpfu.PF_SPINNER, "target", "Target pt", 50, (1, 8000, 2)),
                    (gimpfu.PF_RADIO, "target-width-height", "Fixed misures", DEFAULT_TARGET_PREFIX, (("width", "width"), ("height", "height"))),
                    (gimpfu.PF_BOOL, "x_ldpi",    "  Export 1x",   True),
                    (gimpfu.PF_BOOL, "x_mdpi",    "  Export 2x",   True),
                    (gimpfu.PF_BOOL, "x_hdpi",    "  Export 3x",   True),
                    (gimpfu.PF_RADIO, "image-extension", "Image Format", DEFAULT_OUTPUT_EXT, (("gif", "gif"), ("png", "png"), ("jpg", "jpg"))),
                      ], 
                [], 
                write_xdpi) #, menu, domain, on_query, on_run)

gimpfu.main()
    layerfond = pdb.gimp_image_get_layer_by_name(baseimage, "layer_fond.png")
    layerfleche = pdb.gimp_image_get_layer_by_name(baseimage,
                                                   inNameLayerFleche)

    pdb.gimp_item_set_visible(layerfond, True)
    pdb.gimp_image_merge_down(baseimage, layercache, CLIP_TO_IMAGE)
    pdb.gimp_item_set_visible(layerfleche, True)
    pdb.gimp_image_merge_down(baseimage, layerfleche, CLIP_TO_IMAGE)

    pdb.gimp_image_scale(baseimage, 900, 550)
    # drawable = pdb.gimp_image_get_active_drawable(baseimage)
    pdb.script_fu_multiple_layer_actions(baseimage, None, 0, 0, (0, 0, 0), 4,
                                         0, 0, 0, 0, 0)
    pdb.gimp_message("Taille de l'image ajustée")

    pdb.script_fu_export_layers(baseimage, None, outDir, "~l")
    pdb.gimp_message("Layers enregistrés")


register("build_wesnoth_caches",
         "Wesnoth AMLA tree caches",
         "Build caches for given amla tree",
         "Benoit KUGLER",
         "",
         "2017",
         "Wesnoth ATE",
         "", [(PF_STRING, "string", "args", None)], [],
         load_caches,
         menu="<Image>/Filters")
# a invoquer from console line with python-fu-build-wesnoth-text-effect RUN-NONINTERACTIVE liste
main()
Ejemplo n.º 49
0
            from serial.tools.list_ports_windows import comports
        elif os.name == 'posix':
            from serial.tools.list_ports_posix import comports
        else:
            raise ImportError("Sorry: no implementation for your"
                              "platform ('%s') available" % (os.name, ))
    except ImportError:
        yield "(couldn't import PySerial)", None
    else:
        yield "(disabled)", None
        for port, desc, _ in comports():
            yield '{0} ({1})'.format(port, desc.strip()), port


register(
    "pysstv_for_gimp", "PySSTV for GIMP",
    "Transmits the current image using PySSTV", "Andras Veres-Szentkiralyi",
    "Andras Veres-Szentkiralyi", "November 2013", "<Image>/PySSTV/Transmit...",
    "*", [
        (PF_RADIO, "mode", "SSTV mode", "MartinM1",
         tuple((n, n) for n in sorted(MODULE_MAP.iterkeys()))),
        (PF_BOOL, "vox", "Include VOX tones", True),
        (PF_STRING, "fskid", "FSK ID", ""),
        (PF_RADIO, "ptt_port", "PTT port", None, tuple(get_serial_ports())),
        (PF_RADIO, "ptt_pin", "PTT pin", "RTS",
         tuple((n, n) for n in ("RTS", "DTR"))),
        (PF_BOOL, "ptt_state", "PTT inversion", False),
    ], [], transmit_current_image)

main()
Ejemplo n.º 50
0
    print_tileset(
        chunks_lines,
        os.path.join(tiles_dir, lower_snake_case(tileset_group.name)) + '.png')
    export_json_data(tileset_group, animations, json_data)


def export_tilesets(img):
    json_data = {'tilesets': []}
    if img.filename:
        tiles_dir = create_tile_directory(img)
        for tileset_group in img.layers:
            export_tileset(img, tiles_dir, tileset_group, json_data)
    with open(os.path.join(tiles_dir, 'tilesets.json'), 'w') as json_file:
        json_file.write(json.dumps(json_data, indent=2))


register(proc_name=("tileset_exporter"),
         label=("Export Tilesets"),
         blurb=("Export all layers as a tileset + JSON data"),
         help=("Help?"),
         author=("David Corticchiato"),
         copyright=("www.twoseasgames.com"),
         date=("2013"),
         menu=("<Image>/Tilesets"),
         imagetypes=("*"),
         params=[(PF_IMAGE, 'img', 'Select an image', None)],
         results=[],
         function=(export_tilesets))

main()
Ejemplo n.º 51
0
        
    # Show warning message
    if warnings: 
        warnings.append(UPSCALE_WARN_MESSAGE)
        gimp.message('\n'.join(warnings))

gimpfu.register("python_fu_android_xdpi", 
                "Write Android drawables for all DPI folders", 
                "Write images for all android densities", 
                "Nic", "Nicolas CORNETTE", "2012", 
                "<Image>/Filters/Android/Write Android XDPIs...", 
                "*", [
                    (gimpfu.PF_DIRNAME, "res-folder",     "Project res Folder", DEFAULT_OUTPUT_DIR), #os.getcwd()),
                    (gimpfu.PF_STRING, "image-basename", "Image Base Name", 'icon'),
                    (gimpfu.PF_SPINNER, "target-width", "Target DP Width", 48, (1, 8000, 2)),
                    (gimpfu.PF_BOOL, "x_ldpi",    "  Export ldpi",   False),
                    (gimpfu.PF_BOOL, "x_mdpi",    "  Export mdpi",   True),
                    (gimpfu.PF_BOOL, "x_hdpi",    "  Export hdpi",   True),
                    (gimpfu.PF_BOOL, "x_xhdpi",   "  Export xhdpi",  True),
                    (gimpfu.PF_BOOL, "x_xxhdpi",  "  Export xxhdpi", False),
                    (gimpfu.PF_BOOL, "x_xxxhdpi", "  Export xxxhdpi",False),
                    #(gimpfu.PF_BOOL, "x_tvdpi",   "  Export tvdpi",  False),
                    (gimpfu.PF_RADIO, "image-extension", "Image Format", DEFAULT_OUTPUT_EXT, (("gif", "gif"), ("png", "png"), ("jpg", "jpg"))),
                      ], 
                [], 
                write_xdpi) #, menu, domain, on_query, on_run)

gimpfu.main()

########NEW FILE########
Ejemplo n.º 52
0
    fileabs = os.path.abspath(file)
    #gprint('=== Input ==== ' + fileabs)
    file_dir, filename = os.path.split(fileabs)
    filename = filename[:-4] + '.jpg'
    file_new = os.path.join(OUTPUT_PATH, filename)

    pdb.file_jpeg_save(image, drawable, file_new, file_new, QUALITY, 0, 1, 1, '', 0, 1, 0, 0)
    pdb.gimp_image_delete(image)

    gprint('=== Output === ' + file_new)



args = [(PF_STRING, 'file', 'Input file name', '')]
register(
    'python-save-jpeg',            # proc_name  The name of the command that you can call from the command line or from scripting
    'Save the image to jpeg',      # blurb      Information about the plug-in that displays in the procedure browser
    'Save the image to jpeg',      # help       Help for the plug-in
    'stevenfrog',                  # author     The plug-in's author
    'stevenfrog',                  # copyright  The copyright holder for the plug-in (usually the same as the author)
    '2016',                        # date       The copyright date
    '',                            # label      The label that the plug-in uses in the menu  (<Image>/Image/Save as jpeg)
    '',                            # imagetypes The types of images the plug-in is made to handle (RGB*, GRAY*)
    args,                          # params     The parameters for the plug-in's method
    [],                            # results    The results of the plug-in's method
    plugin_main                    # function   The name of the method to call in your Python code
)

main()
Ejemplo n.º 53
0
gimpfu.register(
    # name
    "spine-export",
    # blurb
    "Spine export",
    # help
    "Exports layers to images and outputs a Spine JSON file",
    # author
    "Carlo Cabanilla",
    # copyright
    "Carlo Cabanilla",
    # date
    "2014",
    # menupath
    "<Image>/File/Export/Export to Spine",
    # imagetypes
    "*",
    # params
    [   
        (gimpfu.PF_ADJUSTMENT, "compression", "PNG Compression level:", 0, (0, 9, 1)),
        (gimpfu.PF_DIRNAME, "dir", "Directory", "/tmp"),
        (gimpfu.PF_STRING, "json_filename", "JSON filename", ""),
        (gimpfu.PF_TOGGLE,   "export_visible_only", "Export visible layers only", True),
        (gimpfu.PF_TOGGLE,   "reverse_draw_order", "Reverse draw order", False),
        (gimpfu.PF_TOGGLE,   "autocrop_layers", "Autocrop layers", False),
        (gimpfu.PF_ADJUSTMENT, "padding_amt", "Padding pixels", 0, (0,100,1))
    ],
    # results
    [],
    # function
    spine_export
)
Ejemplo n.º 54
0
        image.undo_group_end()

def testalgo():
    print "copier(400, 600, 0, 0, 200, 300):"
    for cset in copier(400, 600, 0, 0, 200, 300):
        print cset

    print "copier(833, 1168, 216, 324, 543, 783):"
    for cset in copier(833, 1168, 216, 324, 543, 783):
        print cset

if in_gimp:
    gimpfu.register(
            "python-fu-fractal", # name
            "Make an image into an animated fractal", # blurb
            "Make an image into an animated fractal", # help
            "Ari Pollak, Benjamin Mako Hill, and Mika Matsuzaki", # author
            "Ari Pollak, Benjamin Mako Hill, and Mika Matsuzaki", # copyright
            "2007", # date
            "<Image>/Filters/Fractal Animation", # menupath
            "RGB*, GRAY*", # imagetypes
            [
                (gimpfu.PF_SPINNER, "frames", "# of frames", 10, (1, 30, 1))
            ], # params
            [], # results
            fractal # callback
            )
    gimpfu.main()
else:
    testalgo()
Ejemplo n.º 55
0
_plugin_help = (
    "If the sum of the specified percentages is higher than 100, one or both "
    "of the percentages are automatically adjusted to prevent color inversion "
    "(e.g. 70% black clip and 40% white clip is executed as 60% black "
    "and 40% white clip).")

gimpfu.register(
    proc_name="get_color_clip",
    blurb=("Return the black and white points of a drawable based on the "
           "specified clip percentages."),
    help=_plugin_help,
    author="khalim19",
    copyright="khalim19",
    date="2017",
    label="",
    imagetypes="RGB*, GRAY*",
    params=[
        (gimpfu.PF_IMAGE, "image", "Input image (unused)", None),
        (gimpfu.PF_DRAWABLE, "drawable", "Input drawable", None),
        (gimpfu.PF_FLOAT, "clip_percent_black", "Black clip percentage", 0.0),
        (gimpfu.PF_FLOAT, "clip_percent_white", "White clip percentage", 0.0)
    ],
    results=[(gimpfu.PF_INT, "black_point", "Black point"),
             (gimpfu.PF_INT, "white_point", "White point")],
    function=get_color_clip)

gimpfu.register(
    proc_name="color_clip",
    blurb=
    ("Darken/brighten a given percentage of the darkest/brightest pixels in the "
     "drawable"),
gimpfu.register(
    'python_animation_from_videocaps',
    'Helps preparing an animation from video screencaps.',
    'Helps preparing an animation from video screencaps.',
    'Rebecca Breu',
    '2016 Rebecca Breu, GPLv3',
    '13 March 2016',
    '<Image>/Filters/Animation/Animators/From video screencaps...',
    '*',
    [
        (gimpfu.PF_INT,
         'fps',
         'Frames per second of source video',
         24),
        (gimpfu.PF_SLIDER,
         'reduce_by',
         'Keep every n-th frame',
         4,
         (1, 12, 1)),
        (gimpfu.PF_RADIO,
         'text_mode',
         'Add text?',
         'none',
         (('No text', 'none'),
          ('Regular text', 'regular'),
          ('Blinking text', 'blink')),
        ),
        (gimpfu.PF_LAYER,
         'text_layer',
         'Text layer',
         None),
    ],
    [],
    python_animation_from_videocaps,
)