I needed to convert some 500 images from black-and-white (and
intermediate greys) to red-and-white and red-and-orange. This is not
an interactive task, and is best done using a tool such as
ImageMagick, but I could not imagine how to do it in ImageMagick, so I
decided to use the GIMP for this batch job.
I wrote a Script-Fu with the following function:
(define (script-fu-bcrm infile outfile infg inbg outfg outbg)
(img (car (file-png-load 1 infile infile)))
(drawable (car (gimp-image-active-drawable img)))
(plug-in-color-map 1 img drawable infg inbg outfg outbg 0)
(gimp-convert-indexed img 0 0 16 0 1 "")
(file-png-save 1 img drawable outfile outfile 0 9 0 0 0 1 0)
This function is called by another functions that runs through a list
of file names and passes them as arguments 'infile' and 'outfile'.
However, after running the function about 15 times, GIMP for Windows
hangs and I need to kill the program to restart it. Does anyone have
an idea as to why this happens? Is there anything I can do to measure
what goes wrong?
Real Men Don't Need Anaesthetics