Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;plug-in-edge
- ;1/0 run-interactive non-interactive
- ;image
- ;drawable
- ;float edge detection amount 1 <= amount <= 10
- ;edge detection behavior: none 0, wrap 1, smear 2, black 3
- ;edge detection algorithm: sobel 0, prewitt 1, gradient 2, roberts 3, differential 4, laplace 5
- ;
- ;LAYER-MODE-LCH-LIGHTNESS (27)
- ;(plug-in-edge TRUE img Edge1 edgeradius 1 1) Wrap Prewitt
- ;Sharpen Layer -> the sharpened layer is sharpened with the unsharp-mask plugin and a level mask created with a desaturated image that in precedence it has been filtered with the detect-edge filter in order to regulate the amount of sharpen.
- ;Blur Layer -> the blurred layer is blurred with the gauss-rle plugin and a level mask created with a desaturated and inverted image that in precedence it has been filtered with the detect-edge filter in order to regulate the amount of blur.
- ;After you can modify the levels/curves of the two level masks
- ;the blend mode of the Sharpen and Blur levels is set to LAYER-MODE-LCH-LIGHTNESS (27)
- ;You can also modify the opacity of the Blur level in order to regulate its effect.
- (define (script-FU-SharpBlurEdge2 img drawable edgeradius radius amount threshold radiusblur)
- ;duplico il layer
- (gimp-image-undo-group-start img)
- (let* (
- (new-flatten (car (gimp-image-flatten img)))
- (Edge1 (car (gimp-image-duplicate img)))
- (MaskLayer (cadr (gimp-image-get-layers Edge1)))
- (Duplicated1 (car (gimp-layer-copy new-flatten 0)))
- (Duplicated2 (car (gimp-layer-copy new-flatten 0)))
- )
- (gimp-item-set-name Duplicated1 "Sharpen")
- (gimp-item-set-name Duplicated2 "Blur")
- (gimp-image-insert-layer img Duplicated1 0 -1)
- (gimp-image-insert-layer img Duplicated2 0 -1)
- (gimp-layer-set-mode Duplicated1 27)
- (gimp-layer-set-mode Duplicated2 27)
- (plug-in-edge TRUE Edge1 (aref MaskLayer 0) edgeradius 1 1)
- (gimp-convert-grayscale Edge1)
- (gimp-image-set-active-layer img (car (gimp-image-get-layer-by-name img "Sharpen")))
- (plug-in-unsharp-mask 1 img Duplicated1 radius amount threshold)
- (gimp-image-set-active-layer img (car (gimp-image-get-layer-by-name img "Blur")))
- (plug-in-gauss-rle 1 img Duplicated2 radiusblur 1 1)
- (let* (
- (mask (car (gimp-layer-create-mask (car (gimp-image-get-layer-by-name img "Sharpen")) ADD-BLACK-MASK )))
- )
- (gimp-layer-add-mask Duplicated1 mask)
- (gimp-selection-all Edge1)
- (gimp-edit-copy (aref MaskLayer 0))
- (gimp-floating-sel-anchor (car (gimp-edit-paste mask FALSE)))
- (let* (
- (mask2 (car (gimp-layer-create-mask (car (gimp-image-get-layer-by-name img "Blur")) ADD-BLACK-MASK )))
- )
- (gimp-layer-add-mask Duplicated2 mask2)
- (gimp-selection-all Edge1)
- (gimp-edit-copy (aref MaskLayer 0))
- (gimp-floating-sel-anchor (car (gimp-edit-paste mask2 FALSE)))
- (gimp-drawable-invert mask2 FALSE)
- (gimp-image-delete Edge1)
- )))
- (gimp-image-undo-group-end img)
- (gimp-displays-flush)
- )
- (script-fu-register
- "script-FU-SharpBlurEdge2"
- _"SharpBlurEdge V2"
- _""
- "Andrea Verdi"
- "Andrea Verdi"
- "2018"
- "RGB*"
- SF-IMAGE "Image" 0
- SF-DRAWABLE "Drawable" 0
- SF-ADJUSTMENT _"Radius edge" '(1 0.1 10.0 0.1 1.0 1 0)
- SF-ADJUSTMENT _"Radius sharpen" '(0.3 0.1 10.0 0.1 1.0 1 0)
- SF-ADJUSTMENT _"Amount sharpen" '(0.4 0.1 10.0 0.01 1.0 2 0)
- SF-ADJUSTMENT _"Threshold sharpen" '(0 0 255 1 5 0 0)
- SF-ADJUSTMENT _"Radius Blur " '(0.3 0.1 10.0 0.1 1.0 1 0)
- )
- (script-fu-menu-register "script-FU-SharpBlurEdge2"
- "<Image>/Filters/Image/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement