I'm trying to batch edit a number of jpg images using the BIMP batch processor plugin. This works fine with one of my python-fu scripts but not the other. It simply does nothing to the image, but still saves the 'new' version.
However when the 'bad' script is selected from the menu in the gui, it works perfectly.
This is the script that doesn't work in batch:
#!/usr/bin/env python
from gimpfu import *
def remove_colour(image, drawable):
# start undo
pdb.gimp_image_undo_group_start(image)
#select the area by colour
pdb.gimp_context_set_antialias(1)
pdb.gimp_context_set_feather(1)
pdb.gimp_context_set_feather_radius(1.0, 1.0)
pdb.gimp_context_set_sample_merged(0)
pdb.gimp_context_set_sample_criterion(0)
pdb.gimp_context_set_sample_transparent(0)
pdb.gimp_context_set_sample_threshold_int(100)
background = gimpcolor.RGB(255,255,255)
pdb.gimp_context_set_background(background)
operation = CHANNEL_OP_REPLACE
color = gimpcolor.RGB(00,85,202)
pdb.gimp_image_select_color(image, operation, drawable, color)
#delete the selected area
pdb.gimp_drawable_edit_clear(drawable)
#end undo
pdb.gimp_image_undo_group_end(image)
register(
"python-fu-remove_colour",
"Remove a colour",
"Select by colour then delete",
"A", "A", "2019",
"remove_colour",
"*", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
[
# basic parameters are: (UI_ELEMENT, "variable", "label", Default)
(PF_IMAGE, "image", "takes current image", None),
(PF_DRAWABLE, "drawable", "Input layer", None)
# PF_SLIDER, SPINNER have an extra tuple (min, max, step)
# PF_RADIO has an extra tuples within a tuple:
# eg. (("radio_label", "radio_value), ...) for as many radio buttons
# PF_OPTION has an extra tuple containing options in drop-down list
# eg. ("opt1", "opt2", ...) for as many options
# see ui_examples_1.py and ui_examples_2.py for live examples
],
[],
remove_colour, menu="<Image>/Colors") # second item is menu location
main()
This is the script that works fine in batch
#!/usr/bin/env python
from gimpfu import *
def saturate2(image, drawable):
# start undo
pdb.gimp_image_undo_group_start(image)
#saturation
hue_range = 0
hue_offset = 0
lightness = 0
saturation = 100
overlap = 0
pdb.gimp_drawable_hue_saturation(drawable, hue_range, hue_offset, lightness, saturation, overlap)
pdb.gimp_drawable_hue_saturation(drawable, hue_range, hue_offset, lightness, saturation, overlap)
#end undo
pdb.gimp_image_undo_group_end(image)
register(
"python-fu-saturate2",
"saturate twice",
"Run full saturation twice",
"A", "A", "2019",
"Double Saturate",
"*", # type of image it works on (*, RGB, RGB*, RGBA, GRAY etc...)
[
# basic parameters are: (UI_ELEMENT, "variable", "label", Default)
(PF_IMAGE, "image", "takes current image", None),
(PF_DRAWABLE, "drawable", "Input layer", None)
# PF_SLIDER, SPINNER have an extra tuple (min, max, step)
# PF_RADIO has an extra tuples within a tuple:
# eg. (("radio_label", "radio_value), ...) for as many radio buttons
# PF_OPTION has an extra tuple containing options in drop-down list
# eg. ("opt1", "opt2", ...) for as many options
# see ui_examples_1.py and ui_examples_2.py for live examples
],
[],
saturate2, menu="<Image>/Colors") # second item is menu location
main()
There are no error messages. The script saves the file in a the correct folder but none of the edits have been made. Again, it works fine when selected from the menu, but in batch mode it doesn't.
Any help greatly appreciated.