add gimp scripts
parent
a7060bff9a
commit
d140cc5791
|
@ -0,0 +1,68 @@
|
||||||
|
(define (agw-vec-list vl) (vector->list (cadr vl)))
|
||||||
|
|
||||||
|
(define (agw-p67-font)
|
||||||
|
(for-each
|
||||||
|
(lambda (im)
|
||||||
|
(let ((dr (car (gimp-image-get-active-drawable im)))
|
||||||
|
(fname (car (gimp-image-get-filename im))))
|
||||||
|
(unless (eq? (gimp-image-base-type im) RGB)
|
||||||
|
(gimp-image-convert-rgb im))
|
||||||
|
(gimp-drawable-desaturate dr DESATURATE-LUMINANCE)
|
||||||
|
(gimp-image-convert-indexed
|
||||||
|
im
|
||||||
|
CONVERT-DITHER-NONE
|
||||||
|
CONVERT-PALETTE-CUSTOM
|
||||||
|
0 ; num-cols (ign.)
|
||||||
|
FALSE ; alpha-dither
|
||||||
|
FALSE ; remove-unused
|
||||||
|
"p67 palette")
|
||||||
|
(gimp-file-save RUN-NONINTERACTIVE im dr fname fname)))
|
||||||
|
(agw-vec-list (gimp-image-list))))
|
||||||
|
|
||||||
|
(define (agw-destructure im)
|
||||||
|
(for-each
|
||||||
|
(lambda (dr)
|
||||||
|
(when (gimp-item-is-drawable dr)
|
||||||
|
(plug-in-colortoalpha RUN-NONINTERACTIVE im dr (car (gimp-context-get-foreground)))))
|
||||||
|
(agw-vec-list (gimp-image-get-layers im))))
|
||||||
|
|
||||||
|
(define (agw-export-font start dir pfx sfx im)
|
||||||
|
(letrec ((num (string->number start 16))
|
||||||
|
(pre (string-append dir "/" pfx))
|
||||||
|
(fnc (lambda (ls n)
|
||||||
|
(let* ((dr (car ls))
|
||||||
|
(nx (cdr ls))
|
||||||
|
(dr? (gimp-item-is-drawable dr))
|
||||||
|
(fnm (string-append pre (number->string n 16) sfx)))
|
||||||
|
(when dr?
|
||||||
|
(gimp-file-save RUN-NONINTERACTIVE im dr fnm fnm))
|
||||||
|
(unless (null? nx)
|
||||||
|
(fnc nx (if dr? (succ n) n)))))))
|
||||||
|
(fnc (agw-vec-list (gimp-image-get-layers im)) num)))
|
||||||
|
|
||||||
|
(define author "Alison Gray Watson")
|
||||||
|
(define license "Public domain")
|
||||||
|
(define path "<Image>/:>")
|
||||||
|
|
||||||
|
(script-fu-register
|
||||||
|
"agw-p67-font"
|
||||||
|
"P67 Font" "Converts open images to a project67 font"
|
||||||
|
author license "2021" "")
|
||||||
|
(script-fu-register
|
||||||
|
"agw-destructure"
|
||||||
|
"Destructure" "Deletes foreground color from all layers"
|
||||||
|
author license "2021" ""
|
||||||
|
SF-IMAGE "Image" 0)
|
||||||
|
(script-fu-register
|
||||||
|
"agw-export-font"
|
||||||
|
"Export Layers" "Exports all layers with hex names"
|
||||||
|
author license "2021" ""
|
||||||
|
SF-STRING "Start Number (Hex)" "21"
|
||||||
|
SF-DIRNAME "Output Directory" "/tmp"
|
||||||
|
SF-STRING "Prefix (Optional)" ""
|
||||||
|
SF-STRING "Suffix (Required)" ".png"
|
||||||
|
SF-IMAGE "Image" 0)
|
||||||
|
|
||||||
|
(script-fu-menu-register "agw-p67-font" path)
|
||||||
|
(script-fu-menu-register "agw-destructure" path)
|
||||||
|
(script-fu-menu-register "agw-export-font" path)
|
Loading…
Reference in New Issue