;;
;;   File        : gmic_shell.scm
;;               ( Scheme script for GIMP )
;; taken from    David Tschumperlé script
;; get gmic_gimp_qt plugin from www.gmic.eu


(define	(gmic-shell img drawable)

  ;; Start undo group.
  (gimp-image-undo-group-start img)

  (let* (
         (copy-layer (car (gimp-layer-copy drawable TRUE)))
        )

    ;; Add a copy of the layer to the image.
    (gimp-image-insert-layer img copy-layer 0 -1)

    ;;put your gmic commands in the following
;    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 uncomment & gmic command goes here")
    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 fx_mighty_details 25,1,25,1,11,0,50,50 ")
    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 fx_map_tones_fast 0.7,0.8,7,0,50,50 ")
    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 fx_graphic_boost4 16,0.82,0,0.8,180.8,0,1,1.5,0.3,7,0,1,0,1,1,1,1.4,0.24,3 ")
    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 gcd_hio_levels 1.5,1,39,0,1,1,0,0,0,0 ")
    (plug-in-gmic-qt 1 img drawable 1 0 "-v -99 fx_adjust_colors 0,0,-10,0,0,0,50,50 ")      

    (gimp-image-flatten img)
    
    )

  ;; Flush display.
  (gimp-displays-flush)

  ;; End undo group.
  (gimp-image-undo-group-end img)
  )

(script-fu-register "gmic-shell"
                    _"<Image>/Filters/G'MIC shell..."
                    ""
                    ""
                    ""
                    "2017"
                    "*"
                    SF-IMAGE		"Image"		1
                    SF-DRAWABLE         "Drawable"      1
                    )
