Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Script background removal

I've been given 2000 images (all of students) to make background transparent and I'm absolutely going to be scripting this! Hopefully going to be using BIMP for GIMP on 2.10.10

I'm IT and occasionally dabble in image manipulation, but this is beyond what I know.


1. Layer > Transparancy > Add Alpha Channel
2. Fuzzy Select background. There's flat white background on all images, but different shaped humans in front - the upper most pixels (eg 10,10) are all background.
3. Delete

I've got all input and output folders sorted and ready to go so I just need the above commands for BIMP but I can't see anything that might be useful.

Can this be done in BIMP or do I need to go into scripting it using Python/Script-Fu?

Hope you guys can help!

I do not think it will work with BIMP. For some reason it outputs blank images. BIMP seems to ignore selections.

Using the attached script, (find it in tools -> isolate) apply in Gimp and it works

Using the script in BIMP as a 'other Gimp procedure' and no good. 

2000 images? might be better looking at using ImageMagick. Something like

mogrify -fuzz 10% -transparent white *.png

Anyway, had enough, off to the pub for a beer with friends. Maybe one of the clever guys can assist.

Attached Files
.zip (Size: 415 bytes / Downloads: 17)
From my memos, a Color-to-alpha in IM:
convert infile.png \( -clone 0 -fill "#ffffff" -colorize 100 \) \( -clone 0,1 -compose difference -composite -separate +channel -evaluate-sequence max -auto-level \) -delete 1 -alpha off -compose over -compose copy_opacity -composite outfile.png

(The backslashes ensure that the parens are passed to IM and not interpreted by the shell.)
The problem with BIMP might just be my BIMP 2 version.

Just got round to a try-out (old netbook) Gimp 2.8 / BIMP 1.18 and using that script as 'other Gimp procedure' is working.

Edit: Another try, Gimp 2.10.12 (linux) definitely some bug with BIMP 2.x I can get that background removal with BIMP 1.18 - still available for windows on the Bimp site.

Forum Jump: