I’m an absolute dumbass when it comes to scripting in Gimp but I had tried out this interesting quick technique to get a relatively accurate preview of what an IR image will look like after an RB channel swap. Doing it in Gimp based on the OOC jpeg gives me a chance to preselect images for raw processing (which can be quite a bit more complex) and thus saves me bags of time.
The technique really is nothing much, just a duplicate layer set to layer mode HSL_Color but the script saves a few keypresses and I’d probably try to use it in batch mode as well.
I’m sure people here have tons of ways to do this better, faster, easier so I’m OK with some pushback.
#!/usr/bin/env python # ir_layer.py.py # # License: GPLv3 # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY# without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # To view a copy of the GNU General Public License # visit: http://www.gnu.org/licenses/gpl.html # # Duplicates the base layer (presumably an infrared image), # sets duplicated layer mode to HSL color # such that the result is similar to a red/blue channel swap # # # ------------ #| Change Log | # ------------ # Version 1 10-08-2022 #import Image from gimpfu import * def python_ir_layer(image, drawable): pdb.gimp_image_undo_group_start(image) prev_layer = image.active_layer pdb.gimp_edit_copy(image.active_layer) fsel = pdb.gimp_edit_paste(drawable, False) pdb.gimp_floating_sel_to_layer(fsel) pdb.gimp_invert(fsel) pdb.gimp_layer_set_mode(fsel, 26) pdb.gimp_image_undo_group_end(image) register( "python_fu_ir_color_swap", "Create new layer swap color and set layer mode to HSL color", "Create new layer swap color and set layer mode to HSL color", "Mike Bing", "Mike Bing", "2022", "<Image>/Filters/IR RB channel swap equivalent ...", "RGB*, GRAY*", [ ], , python_ir_layer ) main()