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

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.

Process:

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!

TC
Reply
#2
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

Code:
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   isolate.py.zip (Size: 415 bytes / Downloads: 532)
Reply
#3
From my memos, a Color-to-alpha in IM:
Code:
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.)
Reply
#4
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 isolate.py 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.
Reply
#5
(10-18-2019, 09:08 AM)TC1927 Wrote: Hi,

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.

Process:

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!

TC

Did you ever script this?  I have been given similar instructions but for 2000+ products on a web page.  I found a useful website (removeimage dot bg) but it does require a subscription in order to get full resolution of your images.  I'd rather not subscribe to a singular tool, but if I can't find any plug-ins then I may have to just bite the bullet.
Reply


Forum Jump: