You are here

Request: Batch Color Layer

Hey, I don't know if anyone on here takes requests for plugins or not, but I was wondering if it would be difficult to create a plugin or script that could take a directory (with sub-directories,) full of JPG and TGA files, and apply a black "color" layer to on top of each image. The files also need to be re-saved in the original file format, respectively. I've got several thousand images which need to be "de-colorized" in this manner. I've used Irfanview to convert them to B&W, but that does not achieve the desired effect. As a matter of fact, the images are game textures, and some of the Targas cause errors when converted by Irfanview but not when a color layer is applied in the Gimp. If anything knows of an efficient and simple way to handle batch processing of these files, that'd be great.

Thanks,
Drew

It looks like your method performs the same results as Color->Desaturate and taking the default (Lightness). Here is one to do files in one directory: (define (conv2bw inLoadFile) (let* ((varFileList (cadr (file-glob inLoadFile 1)))) (while (not (null? varFileList)) (let* ((filename (car varFileList)) (image (car (gimp-file-load RUN-NONINTERACTIVE filename filename))) (drawable (car (gimp-image-get-active-layer image)))) (gimp-desaturate-full drawable DESATURATE-LIGHTNESS) (gimp-file-save RUN-NONINTERACTIVE image drawable filename filename) (gimp-image-delete image) ) (set! varFileList (cdr varFileList)) ) ) ) save that to a file (say conv2bw.scm) and call it from the command line (without gimp running) like so: gimp -i -b '(conv2bw "*.jpg")' -b '(gimp-quit 0)' And this will convert all jpg files in that directory and save them back. But It won't do subirectories. -Rob A>
Subscribe to Comments for "Request: Batch Color Layer"