Primeworld hero.scm

From Prime World Wiki
Jump to: navigation, search

This is the GIMP script used to create the oval effect on the hero portraits. Save it as a .scm file in <gimp install path>/share/gimp/2.0/scripts. The script will appear under Filters -> Wiki. If you already have GIMP open you will need to use Filters -> Script-Fu -> Refresh Scripts.

(define (script-fu-primeworld-hero img)
(let*
    (
        (eraser-size 50)
        (width (car (gimp-image-width img)))
        (height (car (gimp-image-height img)))
        (layer (car (gimp-image-get-active-layer img)))
    )
    
    (gimp-image-undo-group-start img)
    (gimp-context-push)
    
    (gimp-layer-add-alpha layer)
    
    (gimp-image-select-ellipse img CHANNEL-OP-REPLACE 0 0 width height)
    
    ; Select eraser, size, and brush
    (gimp-context-set-brush-size eraser-size)
    (gimp-context-set-brush "2. Hardness 025")
    (gimp-context-set-paint-method "gimp-eraser")
    (gimp-context-set-opacity 100)
    
    ; Stroke selection with eraser
    (gimp-edit-stroke layer)
    
    ; Invert Selection
    (gimp-selection-invert img)
    
    ; Clear the Selection
    (gimp-edit-clear layer)
    
    (gimp-selection-none img)
    
    (gimp-context-pop)
    (gimp-image-undo-group-end img)
    (gimp-displays-flush)
)
)

(script-fu-register
    "script-fu-primeworld-hero"
    "Prime World Hero"
    "Crops a hero image for Prime World Wiki."
    "Sigil Baram"
    ""
    "May 9, 2013"
    ""
    SF-IMAGE "Image" 0
)
(script-fu-menu-register "script-fu-primeworld-hero" "<Image>/Filters/Wiki")