RFX-GIMP

Artifact [ab96f22bff]
Login

Artifact [ab96f22bff]

Artifact ab96f22bff9d95ae843e40980d3682137cbfc58d:


&rfx_sendmsg (
  qq{
  
    (let* ((input-file (string-append "$curtmpdir" DIR-SEPARATOR "$in"))
           (image (car (gimp-file-load RUN-NONINTERACTIVE input-file input-file)))
           (layer (car (gimp-image-get-active-layer image))) )
      (let ((retinex-layer (car (gimp-layer-copy layer TRUE)))
            (width (car (gimp-image-width image)))
            (height (car (gimp-image-height image)))
            (edge-layer 0) )
        (gimp-image-add-layer image retinex-layer 0)
        (plug-in-retinex RUN-NONINTERACTIVE image retinex-layer 16 3 0 0.1)
        (gimp-layer-set-mode retinex-layer VALUE-MODE)
        (set! edge-layer (car (gimp-layer-copy layer TRUE)))
        (gimp-image-add-layer image edge-layer 0)
        (let ((temp-layer (car (gimp-layer-copy retinex-layer TRUE))))
          (gimp-image-add-layer image temp-layer 0)
          (set! edge-layer (car (gimp-image-merge-down image temp-layer EXPAND-AS-NECESSARY))) )
        (let ((temp-layer (car (gimp-layer-copy layer TRUE)))
              (buffer "")
              (mask 0) )
          (gimp-image-add-layer image temp-layer 0)
          (set! buffer (car (gimp-edit-named-cut temp-layer "buffer")))
          (set! mask (car (gimp-layer-create-mask retinex-layer 0)))
          (gimp-layer-add-mask retinex-layer mask)
          (gimp-floating-sel-anchor (car (gimp-edit-named-paste mask buffer TRUE)))
          (gimp-buffer-delete buffer)
          (gimp-threshold mask 36 255)
          (plug-in-gauss RUN-NONINTERACTIVE image mask (* 0.01 width) (* 0.01 width) 0)
          (set! buffer (car (gimp-edit-named-copy mask "buffer")))
          (set! mask (car (gimp-layer-create-mask edge-layer 0)))
          (gimp-layer-add-mask edge-layer mask)
          (gimp-floating-sel-anchor (car (gimp-edit-named-paste mask buffer TRUE)))
          (gimp-buffer-delete buffer)
          )
        (plug-in-gauss RUN-NONINTERACTIVE image edge-layer 2.0 2.0 0)
        (plug-in-laplace RUN-NONINTERACTIVE image edge-layer)
        (plug-in-despeckle RUN-NONINTERACTIVE image edge-layer 1 1 0 255)
        (plug-in-vpropagate RUN-NONINTERACTIVE image edge-layer
                            6 ; propagate-mode 
                            3 ; propagating-channel 
                            0.4 ; propagating-rate 
                            15 ; direction-mask 
                            0 ; lower-limit 
                            255 ; upper-limit
                            )
        (gimp-layer-set-opacity edge-layer 80)
        (gimp-desaturate-full edge-layer 1) )
      (gimp-image-flatten image)

      (rfx-save-frame image "$out") )
    }
  );