04-23-2021, 08:45 AM
(04-23-2021, 07:10 AM)bobJ Wrote: Hi,
Thank you for your help.
I've finally got to remove my plain background using this as a plugin in BIMP:
I was able to do this by selecting by color because my background is plain color.Code:
def plugin_remove_plain_bg(timg, tdrawable):
drawable = pdb.gimp_image_active_drawable(timg)
pdb.gimp_image_select_color(timg, CHANNEL_OP_REPLACE, drawable, gimpcolor.RGB(149,85,79)) # 95554f
pdb.gimp_edit_cut(drawable)
Bonus: some isolated pixels had this color and were not contiguous with the background, so removing the entire color does the job the best way for me.
Your background isn't totally a plain color or your object has pixellated edges (or only vertical/horizontal ones). Smooth edges are otherwise obtained with pixels in which the subject color and the background color are accurately blended. Depending on threshold these pixels are not selected by the background selection (leaving a halo) or are selected (making the edge pixellated).