Transparent background in screenshot

Talk about Pixelmator Pro, share tips & tricks, tutorials, and other resources.
User avatar

2019-12-30 22:25:05

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 Pixelmator Pro 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:


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


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 color selection 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!


User avatar

2019-12-31 01:27:02

Hi Volker.
I feel your pain. I had to do something similar once and all I had was MS Paint. There are a few options that I would consider, some of which you may already have looked into.
Option 1. Investigate the export options of the package that creates the images. There may be an export format that has the background on a different layer and removing it might be as simple as clicking on the layer and hitting delete. If there is no such option or all you have been supplied with are screenshots then... on to option 2.
Option 2. Redraw using the original as a source that you trace over. Pixelmator Pro has a good set of vector tools and the ability to set styles that will allow you to recreate the images in less time than you could remove the backgrounds. Upside: if you need a higher resolution version in future, you already have it. Downsides: still time consuming, possibility of introducing errors.
Option 3. A fusion approach. Mask and keep the rounded rectangles, redraw the nodes and lines. Advantages: faster than 2. less chance of error. Downside. No improvement in resolution.

Option 3 would look something like this:
1. Draw a rounded rectangle (solid fill no stroke) so that its corner radius closely matches that used in the diagram. Duplicate it and exactly cover each box. Zoom in and make it pixel-perfect.
2. Gather all your rounded rectangles in a group.
3. Position the group below the image layer in the layers panel.
4. Right-click on the image layer an select Add Clipping Mask. Where your group is opaque, the image will show. Where your group is transparent, you will get transparency.
5. Redraw nodes and lines (because that’s got to be easier than trying to erase up to the edge of a line).

In fact, let me give that a go...
User avatar

2019-12-31 01:39:48

Here's a quick test of option 3.


and here's the source:

Took about 10-15 mins, although with practice you could probably get that below 10.

The lines are drawn using the Draw tool. Click and drag horizontally from a node; click and drag when the line goes vertical; click and drag where it's horizontal again. Practice. You'll get the idea. Double click to edit an existing line. There's a thing I *really* don't like in Pixelmator Pro (at least in 1.5.4) here: The Draw tool is selection-focused, not draw-focused so, if there's a shape under the cursor it won't let you draw (it will select the shape instead). If you've already drawn the dots, you may want to turn off that group when doing this.

Another quick tip, you can release the clipping mask at any time to see the whole layer again or, if you're thinking more clearly than I was when I created this, make a copy of the image layer so that you have one that is part of a clipping mask set and one as reference which you hide when you don't need it.

Hope this helps and, if you get stuck, just shout. There's usually someone here who will help out.

- Stef.
User avatar

2019-12-31 02:31:35

Hi Stef,

thank you so very much for taking the time and writing up your steps and even testing it out! Your result looks exactly like what I want!

Yes, unfortunately Option #1 is ruled out, as our design tool doesn't even allow to save or export the visual aspect of the model, it only persists the underlying data structure. But I do think I will dig in that direction anyway and see if I can hack our renderer to at least maybe use a white background instead of the gray grid.

I really like what you did with the image and I think if I have the need for a single perfect looking graphic I might come back to exactly your process.

But sometimes I take 10+ screenshots of different flows for a blog post (and some flows might have significantly more boxes than the sample flow I shared) and it doesn't seem replicatable enough for "mass conversion".

I am really stunned by your final result, though, as it looks better than my original! Well done!

User avatar

2019-12-31 08:48:30

Hi Volker.
One more thought comes to mind. If you have access to the tool that’s created these images, does it put anything useful on the clipboard if you select all and copy? Odds on it has its own internal format that just contains the properties of the flow but it’s worth a try pasting that into Pixelmator Pro and other apps to see what happens.
Best of luck.
- Stef.
User avatar

2019-12-31 17:07:27

Thank you, Stef, I will try that!