Skip to content

Gimp:Plugin

Example

#!/usr/bin/env python

# sample.py Rel 1
# This is a sample script for practicing writting plug-ins for GIMP
# Created by Tin Tran
# Comments directed to https://gimplearn.net
#
# License: GPLv3
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY# without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# To view a copy of the GNU General Public License
# visit: http://www.gnu.org/licenses/gpl.html
#
#
# ------------
#| Change Log |
# ------------
# Rel 1: Initial release

from gimpfu import *
def python_sample(image, layer) : #FUNCTION DEFINITION
    pdb.gimp_image_undo_group_start(image)
    pdb.gimp_context_push()
    #YOUR CODE BEGINS=======================
    pdb.gimp_message("Hello World")

    #YOUR CODE ENDS ========================
    pdb.gimp_context_pop()
    pdb.gimp_image_undo_group_end(image)
    pdb.gimp_displays_flush()
    #return

register(
    "python_fu_sample",
    "Sample Python Fu Script",
    "Sample Python Fu Script...",
    "Tin Tran",
    "Tin Tran",
    "Oct 2017",
    "<Image>/Python-Fu/Sample...",
    "*",      # Create a new image, don't work on an existing one
    [ 
    #INPUT BEGINS
    #(PF_OPTION, "arrow_side", "Arrows Ends:", SIDE_END, SIDE_NAMES),
    #(PF_TOGGLE, "arrow_close", "Arrows Close:", 0),
    #(PF_SPINNER, "border_width", "Border Width (bevelled width):", 10, (0, 500, 1)),
    #(PF_SPINNER, "shadow_offset_x", "Shadow Offset X:", 6, (-4096,4096,1)),
    #(PF_SPINNER, "shadow_offset_y", "Shadow Offset Y:", 6, (-4096,4096,1)),
    #(PF_SPINNER, "shadow_blur_radius", "Shadow Blur Radius:", 15, (0,1024,1)),
    #(PF_SPINNER, "shadow_opacity", "Shadow Opacity:", 100, (0,100,1)),
    #INPUT ENDS
    ],
    [],
    python_sample)

main()

See also

Favorite site

  • []