Skip to content

Instantly share code, notes, and snippets.

@devsli
Created September 10, 2016 19:48
Show Gist options
  • Save devsli/12e93d7aab0888246fde088420be3342 to your computer and use it in GitHub Desktop.
Save devsli/12e93d7aab0888246fde088420be3342 to your computer and use it in GitHub Desktop.
GIMP: Careful stroke
(define (script-fu-stroke image drawable selection-grow-steps)
(let* (
(selected-layer (car (gimp-image-get-active-layer image)))
(width (car (gimp-image-width image)))
(height (car (gimp-image-height image)))
(image-mode 1)
(stroke-layer-name "Stroke")
(stroke-opacity 100)
(overlay-mode NORMAL-MODE)
(stroke-layer (car (gimp-layer-new image width height image-mode stroke-layer-name stroke-opacity overlay-mode)))
)
(gimp-image-undo-group-start image)
(gimp-image-add-layer image stroke-layer (get-sublayer-position image selected-layer))
(gimp-edit-clear stroke-layer)
(gimp-selection-layer-alpha selected-layer)
(gimp-selection-grow image selection-grow-steps)
(gimp-edit-fill stroke-layer 1)
(gimp-selection-none image)
(plug-in-autocrop-layer 0 image stroke-layer)
(gimp-image-undo-group-end image)
(gimp-displays-flush)
)
)
(define (get-sublayer-position image layer)
(+
(car (gimp-image-get-layer-position image layer))
1
)
)
(script-fu-register "script-fu-stroke"
_"Careful stroke..."
_"Add nice stroke to current layer"
"Leonid Suprun"
"Leonid Suprun"
"2008"
"RGBA"
SF-IMAGE "Image" 0
SF-DRAWABLE "Drawable" 0
SF-ADJUSTMENT "Stroke width (pixels)" '(4 1 100 1 10 0 0)
)
(script-fu-menu-register "script-fu-stroke" "<Image>/Filters/Alpha to Logo")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment