How do I get transparent words on a background

Post questions on how to use or achieve an effect in Inkscape.
tiff
Posts: 2
Joined: Wed May 10, 2017 2:47 pm

How do I get transparent words on a background

Postby tiff » Wed May 10, 2017 3:01 pm

I have been through the forums, several tutorial videos, youtube, etc and I simply cannot figure out how to make this work. I need to take words that are on top of a layer (usually a shape) with a background fill. I can make the words transparent but it is still going to be the background fill layer color (red) rather than transparent when I export as a png. I need to make the letters transparent all the way to the base. I have tried converting the text and every single path option (union, difference, etc) but it doesn't seem to work. Please, what am I missing? This must be not only possible but very simple. I have attached both a jpg and an svg example file.
inkscape jpg for transparent words help.jpg
inkscape jpg for transparent words help.jpg (65.35 KiB) Viewed 1658 times
Attachments
ink forum transparent words on background help file.svg
(2.61 KiB) Downloaded 253 times

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: How do I get transparent words on a background

Postby Xav » Wed May 10, 2017 5:16 pm

It's not actually as easy as it should be, due to SVG not having any notion of an "inverse" clipping path. There are a couple of approaches you could take. First, clipping:

1) Draw a rectangle that covers the background.
2) Move the text to the top.
3) Select both the text and the rectangle then use Path > Difference to create an "inverse" path.
4) Select the new path and the background, then use Object > Clip > Set.
5) If you want an outline to the text, you'll need to duplicate it at step 2, so that you're left with an original text copy you can raise to the top.

The trouble with this is that the text, once converted to a path, is no longer editable as text. If that's important to you, masking might be a better option:

1) Draw a WHITE rectangle that covers the background.
2) Raise the text to the top. Give it a BLACK fill and no stroke.
3) Select both the rectangle and the text, and group them.
4) Select both the group and the background then use Object > Mask > Set.
5) If you want an outline to the text, you'll need to duplicate it at step 2, so that you're left with an original text copy you can raise to the top.

A useful alternative to the second approach is to move the text away from the background then "unset" the fill and stroke. Now you can clone it to create the text objects used in steps 2 & 5. Once you've finished, any changes to the original text will be reflected in the clones, so you don't have to unset the mask to edit the text, or try to keep both copies in sync.

I've attached a file containing all three approaches.
Attachments
transparent_text.svg
(15.62 KiB) Downloaded 306 times
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I get transparent words on a background

Postby Moini » Thu May 11, 2017 3:10 am

Somehow I don't understand why selecting both, then doing Path -> Difference doesn't provide the expected result. There must be something I don't get, but I can't figure out what it is.

The image's background is white transparent, btw., so that's not what could be referred to. I understand about keeping the text editable.

I think this could be the reason why it didn't work for tiff:
when the text had been converted to path before the difference operation, then it's a group. Groups do not work with Path -> Difference. So don't convert first, just do the difference. Or ungroup the group, then combine all letters, then do the difference.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

tiff
Posts: 2
Joined: Wed May 10, 2017 2:47 pm

Re: How do I get transparent words on a background

Postby tiff » Thu May 11, 2017 3:23 am

Thank you very much Moini. I couldn't figure out why nothing seemed to be happening when I chose any of the path options. But you are right. When I chose one letter at a time, it works. It just didn't like the group of text.

Moini
Posts: 3381
Joined: Mon Oct 05, 2015 10:44 am

Re: How do I get transparent words on a background

Postby Moini » Thu May 11, 2017 7:52 am

When something like this happens, tiff, it's always useful to take a look into the status bar to learn more about the object type that you have selected and any possible error messages.
Something doesn't work? - Keeping an eye on the status bar can save you a lot of time!

Inkscape FAQ - Learning Resources - Website with tutorials (German and English)

User avatar
Xav
Posts: 1209
Joined: Fri May 08, 2009 1:18 am
Location: UK
Contact:

Re: How do I get transparent words on a background

Postby Xav » Thu May 11, 2017 5:26 pm

Just to note that a simple Path > Difference does have some downsides: it doesn't leave the text editable, and only works when the background is a single path itself. If the background could be more complex than that, it either needs a lot more effort to cut through each item separately, or to switch to clipping/masking, with the background objects in a single group. Masking (possibly with clones), as I described above, is the only simple approach I can think of that will leave the text editable.
Co-creator of The Greys and Monsters, Inked - Inkscape drawn webcomics
Web SiteFacebookTwitter


Return to “Help with using Inkscape”