Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
batch processing with the fuzzy select tool
I'm new to scripting, but I have a programming background, so I think I can do this. I have Python skills. 

I have a short movie, which I've exported to 570 individual png files. What I want to do is apply the fuzzy select tool, with a selectivity of 70, smack dab in the center of each png, cut the resulting selection, and save the file somewhere that doesn't overwrite the original.

I thought I might be able to do this using bimp, I've got it running, but it doesn't seem to support the gimp_image_select_contiguous_color function that I would need to do this. Maybe, or maybe I'm looking at it wrong.

When I start googling gimp scripting I find posts going back to the last century. I don't know what the best current methodology is, nor how to get started? I don't want to waste time reading obsolete documentation or approaches to the problem. So I thought i'd ask here.

I'm running on MacOS Big Sur running GIMP 2.10
First of all the caveat: Although I do use BIMP I am no coder, so very probably doing something basically wrong.

One problem with BIMP is some 'commands' are blacklisted, '-save, -free, -select ...' for example, which means the command you want does not show. The way around this is put the commands into a python plug-in and call the plug-in using BIMP's 'Other GIMP procedure'

I keep a BIMP boilerplate script and your procedure might look like this, nothing clever, very linear in operation

#!/usr/bin/env python
# -*- coding: utf-8 -*-

from gimpfu import*

def plugin_for_bimp(timg, tdrawable):
   Width = tdrawable.width
   Height = tdrawable.height

   centery = Width*1/2
   centerx = Height*1/2

   pdb.gimp_fuzzy_select(tdrawable, centerx, centery, 70, 0, TRUE, 0, 0,FALSE)
   pdb.gimp_selection_grow(timg, 2)

       "for bimp",


EDIT: If you try that remember to save it as, put it in your user profile plugins folder and make it executable.

That registers in the Tools menu and you can try it on an individual image.

The problem is now BIMP and in particular BIMP version 2.x   Apply that to the images and it renders 100% transparent images. An older version BIMP 1.8 works OK, so it looks to me like a BIMP 2.x problem. A shame you are using MacOS where only a BIMP 2.5 is available.

FWIW As an example, a 50 second animation using BIMP 1.8

You might be able to run the script from command line, I have never had much success there. I will leave that for the clever guys Wink
An exemple here:

This is for Windows but it states the changes for Linux/OSX.
(07-18-2021, 03:15 AM)DThompson55 Wrote: I solved it a different way. I used a macro / keystroke recorder to replay the mouse clicks and buttons I used, ran it in a loop, and it worked just fine with no coding. Always more than one way to skink a cat.

Forum Jump: