It is currently Thu Sep 24, 2026 9:38 am


All times are UTC - 5 hours [ DST ]



Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: Transparent background in screenshot
PostPosted: Mon Dec 30, 2019 5:03 pm  (#1) 
Offline
GimpChat Member

Joined: Dec 30, 2019
Posts: 5
GIMP Version: 2.8.14
Operating System: Mac OS
OS Version: Catalina
GIMP Experience: New User



Hello y'all!

I feel rather humbled having to ask this but here goes: I work with hundreds of screenshots of a graphical design tool the company I work for created and I would like to modify these screenshots and make the background transparent.

I have done similar things many times but our design tool seems to be using gray tones everywhere and also some drop shadows, which makes this usually quite simple task pretty involved and a manual process.

I wonder if any of you can help me automate this through a custom filter or plugin or any other means that GIMP supports, because I spend roughly 1h on a medium screenshot and I have potentially hundreds to deal with in the future.

Here is an example original and unmodified screenshot:
Image

Here is where I want to get to (just better, the lines don't look good and I deleted some of borders by mistake):
Image

The challenge is that our design tool creates this grid and the drop shadows and overall uses a not very high-contrast color scheme. I am creating technical content (blogs, documents, etc.) where I want to use those flows but not the ugly background.

So far, I have done this:
1. Used the fuzzy select tool to make 90%+ of the background transparent
2. Use the eraser tool to finish up the rest.

Thank you so much for any hints or tips to point me in the right direction!

Cheers.
Volker


Share on Facebook Share on Twitter Share on Orkut Share on Digg Share on MySpace Share on Delicious Share on Technorati
Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Mon Dec 30, 2019 5:36 pm  (#2) 
Offline
Administrator
User avatar

Joined: Aug 10, 2012
Posts: 14207
Location: Native to NYC living in Arizona, Gimp 2.8 - 3.0, Win 11 PC.
What you seem to be doing,
is modifying existing images.

It might be better to create a few templates,
that you can work from.
This could and should include mostly paths,
saved selection and any font you might use.
Which can be use again and again.

This way you can create clean looking transparent PNG images,
which in the long run will increase your workflow.

_________________
Image
"A wise man learns more from a foolish question than a fool can learn from a wise answer"
Image


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Mon Dec 30, 2019 6:31 pm  (#3) 
Offline
GimpChat Member

Joined: Dec 30, 2019
Posts: 5
Hi Wallace,

yes, you are right. I am modifying screenshots, not creating anything from scratch.

I thought about recreating the flows in a vector program but it is important they look similar to what our design tool produces and I think re-creating hundreds of flows might take even longer than removing the background.

Thank you for your suggestion!

Cheers.
Volker


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Tue Dec 31, 2019 4:28 am  (#4) 
Offline
GimpChat Member
User avatar

Joined: Nov 04, 2015
Posts: 1477
rich2005 wrote a python script for me called 'clear_alpha.ph
It has a handy slider to adjust the alpha transparency to just where you want it on a layer(s).

http://gimpchat.com/viewtopic.php?f=25&t=16294


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Tue Dec 31, 2019 5:16 am  (#5) 
Offline
Script Coder
User avatar

Joined: Oct 25, 2010
Posts: 4812
Possible solution:

1) Select a square that is the tile of the background pattern and copy it to the clipboard (in your image it's a 10x10 square). If you select the top right corner the next step will be easier.
2) Add a new layer, start the bucket fill tool, the the pattern to "Clipboard" (1st in list) and bucket fill. If you cut the top right corner the grid in the new pattern will be aligned with the one in the image. Otherwise you have to create a slightly wider layer, fill it and shift it to align the grids.
3) Add a layer group, move the two layers to it, pattern on top
4) Set the top layer to "Color erase" mode (this requires Gimp 2.10)
5) Add a white layer, outside the group

This removes the grid on the background, but instead you see it in some boxes:

Attachment:
RemovedGrid.png
RemovedGrid.png [ 84.51 KiB | Viewed 3662 times ]

_________________
Image


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Tue Dec 31, 2019 12:05 pm  (#6) 
Offline
GimpChat Member

Joined: Dec 30, 2019
Posts: 5
Thank you, @tas_mania and @ofnuts!

@ofnuts, your result looks really good! I fear I won't be able to automate it, though. I think I have to focus on improving my starting position. If I can get our design tool to start with a white background instead of a gray grid, that will make it so much easier! Your approach will definitely work for individual images but I will have to deal with hundreds of screenshots of different flows. I am learning, though, how you use layers and groups to achieve what I thought was impossible. Really cool!

Thank you both!


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Tue Dec 31, 2019 1:01 pm  (#7) 
Offline
GimpChat Member
User avatar

Joined: Apr 15, 2017
Posts: 1837
...........Or just use the Curves tool and do it in a couple of seconds.

Attachment:
curves.jpg
curves.jpg [ 194.36 KiB | Viewed 3629 times ]


Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Wed Jan 01, 2020 4:16 am  (#8) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 205
Hello vsheuber

Attachment:
clean-image.zip [1.04 KiB]
Downloaded 156 times


This script works on my gimp 2.8.22, located at "<Image>/On test/Clean image"

Running the script on your original image gives the first image below

The second image is 10-15 minutes tidying up the top layer

The third image is after another 10-15 minutes of painting black on the mask to allow the insides of the boxes to show through

Hope it works/helps, though racer-x curves looks the way to go

Steve
Attachment:
after script runs.png
after script runs.png [ 7.71 KiB | Viewed 3598 times ]

Attachment:
tidied.png
tidied.png [ 7.04 KiB | Viewed 3598 times ]


Last edited by Steve on Wed Jan 01, 2020 12:52 pm, edited 1 time in total.

Top
 Post subject: Re: Transparent background in screenshot
PostPosted: Wed Jan 01, 2020 4:17 am  (#9) 
Offline
GimpChat Member
User avatar

Joined: Dec 26, 2014
Posts: 205
Third image
Attachment:
after painting on mask.png
after painting on mask.png [ 28.84 KiB | Viewed 3598 times ]


Top
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC - 5 hours [ DST ]



* Login  



Powered by phpBB3 © phpBB Group