I have been trying desperately just to change the color map on a group of indexed pngs in a folder.
Consistently, using the file glob code that was in the tutorials, it always tells me Opening 'C:\[long correct path]\*.png' failed: Could not open 'C:\[long path]\*.png' for reading: Invalid argument.
"C:\Program Files\GIMP 2\bin\gimp-2.8.exe" -i -b '(batch-color-map "*.png" "Palette")' -b '(gimp-quit 0)'
is my batch file's line
After the first error it gives Opening: 'C:\\[long path]\Palette)'' failed: No such file or directory
Opening: 'C:\\[long path]\0)'' failed: No such file or directory
The path is perfect but I can't figure out why it's parsing all of those as file names, especially the 0 which I have no idea the source of, and failing miserably trying to open them.
(define (batch-color-map pattern palette)
(let* ((filelist (cadr (file-glob pattern 1))))
(while (not (null? filelist))
(let* ((filename (car filelist))
(image (car (gimp-file-load RUN-NONINTERACTIVE
(drawable (car (gimp-image-get-active-layer image))))
(script-fu-set-cmap image drawable palette)
image drawable filename filename)
(set! filelist (cdr filelist)))))
The script-fu-set-cmp I got from somewhere else:
(define (script-fu-make-cmap-array palette)
(num-colours (car (gimp-palette-get-info palette)))
(cmap (cons-array (* num-colours 3) 'byte))
(while (< i num-colours)
(set! colour (car (gimp-palette-entry-get-color palette i)))
(aset cmap (* i 3) (car colour))
(aset cmap (+ (* i 3) 1) (cadr colour))
(aset cmap (+ (* i 3) 2) (caddr colour))
(set! i (+ i 1))
(define (script-fu-set-cmap img drawable palette)
(* (car (gimp-palette-get-info palette)) 3)