It is currently 25 Feb 2020, 20:51


GIMP/GL:  Tutorials | Tips | Questions | Interests | 🡆 Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Request to remove BG, and crop layers

Post your Script Requests for GIMP here.
Forum rules
Request your Script(s) for GIMP here in this forum.
Provide details of steps performed in GIMP so that script can be written for the process and also give the request a name so that scripts can be named after.
Post Reply
Mapsking
Forum Member

Request to remove BG, and crop layers

Post#1 by Mapsking » 12 Jan 2020, 17:59


Hello, is there a way to automate a task of removing the background (solid consistent color, or be selectable), and then changing the layer size to the cut to content option?

So if I have, for example, 180 frames of animation, as layers in an image, and want to do this for each layer, is there a way to do it, or would someone be willing to look into making it?

Thanks, Mapsking
0

tim
GL Blogger

Post#2 by tim » 12 Jan 2020, 23:21


How do you remove background, color-to-alpha?
If so are you guaranteed to have no similarity of background color in your image...because color-to-alpha will make undesired results of foreground going partly transparent when the color is similar (they don't even have to be exact).
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
0

Mapsking
Forum Member

Post#3 by Mapsking » 13 Jan 2020, 05:01


No, I had a consistent color BG, so I use the color select tool, and manually just selected it and deleted, leaving a transparent background.
0

tim
GL Blogger

Post#4 by tim » 13 Jan 2020, 05:32


so would picking color select at location(1,1) good and delete be good enough?
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
0

Mapsking
Forum Member

Post#5 by Mapsking » 25 Jan 2020, 16:37


Sorry @tim, just now saw this. That's a great idea, I think it would work perfectly.
0

tim
GL Blogger

Post#6 by tim » 25 Jan 2020, 16:58


Mapsking wrote:
25 Jan 2020, 16:37
Sorry @tim, just now saw this. That's a great idea, I think it would work perfectly.

use the below code (one-liner) with the Run code on visible layers plug-in

Code: Select all

num_channels,pixel=pdb.gimp_drawable_get_pixel(layer,1,1);color = (pixel[0],pixel[1],pixel[2]);pdb.gimp_image_select_color(image,CHANNEL_OP_REPLACE,layer,color);pdb.gimp_edit_clear(layer);pdb.plug_in_autocrop_layer(image,layer);
aka Tin
:tree_02:
Tin's: Favorite Index | Simple Art === fb4yt video search | fb4yt recent video views report
Lottery numbers from image | Interested Members in TLF
Paying for hosting is to support my hobby, and donating money made from ads to The Red Cross.
         
0


GIMP/GL:  Tutorials | Tips | Questions | Interests | 🡆 Script Requests
Recommendations:  Index | Top 10
Resources:  Python-Fu Plug-ins | Scheme-Fu Scripts | GIMP
Python:  Lessons | Questions | Exercises
The Arts:  GIMPed | GIMPed Photos | Other | Contests | Public Domain Images | Isolated Images | Blender
Inkscape
Social:  Say Hello | Anything Goes | Shares | FCSP

Post Reply
  • Similar Topics
    Replies
    Views
    Last post
• Featuring Members' Works (Image Attachments) •
1: member
2: member
3: member
4: member
5: member

Who is online

Users browsing this forum: No registered users and 2 guests