User:Inductiveload/Remove-paper-texture.scm

; "Remove Paper Texture" is a script for The GIMP
;
; Removes paper texture from scanned images
;
; The script is located in menu "<Image> / Filters / Enhance"
; Last changed: 24 August 2010
;
; 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.

(define (script-fu-remove-paper-texture
    Image
    Layer
)

    ;Start an undo group so the process can be undone with one undo
    (gimp-image-undo-group-start Image)

    ;Apply the levels
    (gimp-levels Layer 1 40 180 1.0 0 255)
    (gimp-levels Layer 2 40 180 1.0 0 255)
    (gimp-levels Layer 3 40 160 1.0 0 255)
        
    ;Desaturate
    (gimp-desaturate Layer)

    ;Finish the undo group for the process
    (gimp-image-undo-group-end Image)

    ;Ensure the updated image is displayed now
    (gimp-displays-flush)
    
)

;Register the script w/ GIMP.

(script-fu-register

        "script-fu-remove-paper-texture"            ;func name

        "Remove Paper Texture"                      ;menu label

        "Removes paper texture from scanned images.";description

        "Inductiveload"                             ;author

        "GPL"                                       ;copyright notice

        "Aug. 2010"                                 ;date created

        ""                                          ;image type that the script works on



          SF-IMAGE    "Image"         0

          SF-DRAWABLE "Layer to convert" 0



)

(script-fu-menu-register "script-fu-remove-paper-texture"
    "<Image>/Filters/Enhance")