All pastes #1357851 Raw Edit

script-fu

public text v1 · immutable
#1357851 ·published 2009-03-11 01:37 UTC
rendered paste body
(define (script-fu-danmc-font-scan inImage inLayer
				   inGrowSize 
				   inCopy)
  (let* (
	 (color '(128 128 128) )
	 )

    (gimp-image-undo-group-start inImage)
    (gimp-selection-all inImage)
    
    ;; If asked to work on a copy, then make a copy first
    (set! theImage (if (= inCopy TRUE)
		       (car (gimp-image-duplicate inImage))
		       inImage)
	  )
    
    (set! theLayer (car (gimp-image-flatten theImage)))
    (set! drawable (car (gimp-image-get-active-layer theImage)))


    ;; Deselect everything
    ;;(gimp-selection-none theImage)
    
    ;; select the black regions
    (gimp-by-color-select drawable color 64 
			  CHANNEL-OP-REPLACE FALSE
			  FALSE 0 FALSE)
    
    ;;(gimp-selection-invert theImage)
    ;; Grow the selection
    ;;(gimp-selection-grow theImage inGrowSize)
    (gimp-image-undo-group-end inImage)
    
    )
  )
  
(script-fu-register "script-fu-danmc-font-scan"
                    _"_Font Scan..."
                    "Process a scanned glyph in preparation for fontforge"
                    "Dan McMahill"
                    "2009, Dan McMahill"
                    "10th March 2009"
                    "RGB* GRAY*"
                    SF-IMAGE      "The image"     0
                    SF-DRAWABLE   "The layer"     0
                    SF-ADJUSTMENT _"Grow size"  '(20 0 300 1 10 0 1)
                    SF-TOGGLE     _"Work on copy" FALSE)

(script-fu-menu-register "script-fu-danmc-font-scan"
                         _"<Image>/Script-Fu/Dan/Font Scan")