Advertisement
metallaro1980

script-fu sharpening

Apr 13th, 2018
644
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.20 KB | None | 0 0
  1. ;LAYER-MODE-LCH-LIGHTNESS (27)
  2. ;LAYER-MODE-DARKEN-ONLY-LEGACY (9)
  3. ;you can use also 27 instead of 10
  4. ;
  5. (define (script-FU-Mazzetta img drawable radius amount threshold)
  6. ;duplico il layer
  7. (gimp-image-undo-group-start img)
  8.  
  9. (let* (
  10. (MaskImage (car (gimp-image-duplicate img)))
  11. (MaskLayer (cadr (gimp-image-get-layers MaskImage)))
  12. (value-layer1 (car (gimp-layer-copy drawable 0)))
  13. (value-layer2 (car (gimp-layer-copy drawable 0)))
  14. )
  15.  
  16. (gimp-item-set-name value-layer1 "Blend10")
  17. (gimp-item-set-name value-layer2 "Blend09")
  18. (gimp-image-insert-layer img value-layer1 0 -1)
  19. (gimp-image-insert-layer img value-layer2 0 -1)
  20. (gimp-image-set-active-layer img (car (gimp-image-get-layer-by-name img "Blend10")))
  21.  
  22. (gimp-layer-set-mode value-layer1 27)
  23. (plug-in-unsharp-mask 1 img value-layer1 radius amount threshold)
  24.  
  25. (gimp-image-set-active-layer img (car (gimp-image-get-layer-by-name img "Blend09")))
  26. (gimp-layer-set-mode value-layer2 9)
  27. (gimp-layer-set-opacity value-layer2 50)
  28.  
  29.  
  30.  
  31. (let* (
  32. (new-layer (car (gimp-image-merge-down img (car (gimp-image-get-layer-by-name img "Blend09")) 1 )))
  33. )
  34. (gimp-image-set-active-layer img (car (gimp-image-get-layer-by-name img "Blend10")))
  35. (gimp-item-set-name new-layer "Blend10")
  36. (gimp-layer-set-mode new-layer 27)
  37. ;(gimp-convert-grayscale MaskImage)
  38.  
  39.  
  40. (let* (
  41. (mask (car (gimp-layer-create-mask (car (gimp-image-get-layer-by-name img "Blend10")) ADD-BLACK-MASK )))
  42. )
  43. (gimp-layer-add-mask new-layer mask)
  44. (gimp-selection-all MaskImage)
  45. ;new mod
  46. (plug-in-vinvert TRUE MaskImage (aref MaskLayer 0))
  47. (gimp-edit-copy (aref MaskLayer 0))
  48.  
  49. (gimp-floating-sel-anchor (car (gimp-edit-paste mask FALSE)))
  50. (gimp-image-delete MaskImage)
  51. ;(gimp-drawable-invert mask FALSE)
  52.  
  53.  
  54.  
  55. )))
  56.  
  57. (gimp-image-undo-group-end img)
  58. (gimp-displays-flush)
  59.  
  60.  
  61. )
  62. (script-fu-register
  63. "script-FU-Mazzetta"
  64. _"Mazzetta v2"
  65. _""
  66. "Andrea Verdi"
  67. "Andrea Verdi"
  68. "2018"
  69. "RGB*"
  70. SF-IMAGE "Image" 0
  71. SF-DRAWABLE "Drawable" 0
  72. SF-ADJUSTMENT _"Radius min" '(0.3 0.1 120.0 0.1 1.0 1 0)
  73. SF-ADJUSTMENT _"Amount min" '(0.4 0.1 10.0 0.01 1.0 2 0)
  74. SF-ADJUSTMENT _"Threshold min" '(0 0 255 1 5 0 0)
  75.  
  76. )
  77.  
  78.  
  79. (script-fu-menu-register "script-FU-Mazzetta"
  80. "<Image>/Filters/Image/")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement