Very Useful Gimp Batch Mode Command

This command will be very useful for changing a particular image's background to transparent if it is white. Also this will make another copy by replacing the color black to while. 

This can be edited to suit the color requirements. 

Please note: color has to be specified with in '(255 255 255) format. This is the RGB value in 0..255 scale. 

gimp -i -b "(let* ( ( image (car (file-png-load 1 \"/home/simucentral/Desktop/art/tees/temp/img1.png\" \"/home/simucentral/Desktop/art/tees/temp/img1.png\") ) ) (drawable (car (gimp-image-active-drawable image) ) ) ) (plug-in-colortoalpha 1 image drawable '(255 255 255) ) (gimp-file-save RUN-NONINTERACTIVE image drawable \"/home/simucentral/Desktop/art/tees/temp/img2.png\" \"/home/simucentral/Desktop/art/tees/temp/img2.png\") (gimp-context-set-foreground '( 255  255  255)) (gimp-image-select-color image 0 drawable '(000 000 000)) (gimp-drawable-edit-fill drawable 0) (file-png-save-defaults RUN-NONINTERACTIVE image drawable \"/home/simucentral/Desktop/art/tees/temp/img3.png\" \"/home/simucentral/Desktop/art/tees/temp/img3.png\") )" -b "(gimp-quit 0)"

Comments