6

I wish to achieve a white icon (final result is a white PNG image with transparency).

For example - I want a white rectangle with the text "NOTHING HERE" subtracted from that rectangle (I want the final PNG to have the transparency where the text is).

Doing this is very simple - I create a rectangle, add the text, then subtract the text (possibly after converting it to a path) from the rectangle.

This works, but leaves the text fixed and I can no longer edit it.

The above is a simplified description of what I'm facing. I usually don't work with just text - I need to subtract one shape from another, but I'd like to be able to keep working on the shape used for the subtraction.

I was thinking about using a mask, but I can't seem to figure out how would I use it for this case. That said, editing masks / clips is also made more difficult. Ideally I'd like to use a filter which simply makes anything below the object it's applied to "vanish", but I'm not sure which filter I should use (and how I should configure it).

EDIT: Quick note - I used to work a bit with Corel Draw. If memory serves, Corel can turn an object into a sort of mask-like filter, where it applies whatever effect you select to anything directly under the object. I believe it's called a lens. Said lenses could apply various effects (including color manipulation and more). Doesn't Inkscape have anything similar?

1
  • Hi Shaamaan, welcome to GD.SE. I edited the title of your question for clarity. If I changed anything beyond all recognition of your intent, feel free to edit back! If you have questions about this Stack, have a look at the help center or join us in the Graphic Design Chat. Keep contributing and enjoy!
    – Vincent
    Commented Jul 22, 2016 at 10:56

3 Answers 3

9

This is possible to do with masks, and keep the text as text. With the creative use of clones, you can also make it so the text is editable without having to release the mask too!

gif of result

Here is a quick run of the steps:

  1. First, create your rectangle that you want to 'cut' the text out of I made mine magenta

  2. Next, duplicate the magenta rectangle, and make it 100% White.

  3. Add your text above the white rectangle, and make the text 100% Black.

  4. Clone the text object (Alt + D)

  5. Select the cloned text object and the white rectangle, and group them together.

  6. Select the Magenta rectangle, and the group containing the clone and the white rectangle, and do Edit > Mask > Set

  7. Select the original text object, add it to a group by itself, and set the master opacity (the slider at the bottom the fill/stroke dialog) of this group to 0.

  8. Select everything, and group it all together. To edit the text object, pick the Text tool, and click on the text to edit.

2
  • I'm confused by this solution. I thought I understood how it works, but it seems my Inkscape is acting up, or the solution isn't as simple. A) Why are you grouping the text object all by itself? B) The point 5) seems to be difficult to perform. In the end I moved the clone, selected the original, then Ctrl-Z the move order, and Shift-selected the cloned group. Is that the way to do it? C) For some reason the final object behaved as if it had opacity 60% (or something along those lines). It's as if the clone of the original rectangle wasn't turned white?
    – MBender
    Commented Jul 26, 2016 at 7:02
  • In a black and white mask, anything under white shows up while anything under black becomes invisible, allowing objects below the masked object to show through. Normally, after making the original text transparent, we would expect the cloned black text to become transparent inside the mask as well, leaving the mask all white and making all parts of the magenta object visible. But we did not make the original text transparent – we made the group containing the original text transparent. The clone won't obey opacity changes to a group containing its original. That's why the trick works. :) Commented Sep 14, 2016 at 12:52
1

When I need to "destroy" an object (often text being converted to a path) that I might want to keep for later, I use layers.

Open the Layers dialog with Ctrl+Shift+L. Create a layer and call it something like "Text". When you are ready to finish the image, duplicate the text layer, convert it to paths (or whatever you need), and then hide the original. If I want to edit the text later, I delete the duplicate layer, and edit the original.

Keeping the "destructible" objects contained in their own layer makes the process much easier. For example, if I have a layer that is just text and I want to convert it all to path, it's a simple Ctrl+A, Ctrl+Shift+C to convert the layer.

Note: Layers aren't actually part of the SVG standard. Inkscape's implementation of a "layer" is actually an svg group (which is valid SVG) that has a special attribute so Inkscape knows to treat it differently. Toggling the visibility of a layer is OK if you are using the SVG on a web page or something, since dispaly:none is a valid attribute for a group, although it will increase the size of the SVG.

3
  • So, basically, you create a copy of the object you intent do destroy. I pretty much do the same thing, currently, albeit my solution is probably less "pretty" (I duplicate it and just put it nearby, since when making the PNG images I always export only the selected area). I was hoping there's an easier way tho... Also, keep in mind that BOTH objects get destroyed - in the example, it's the text as well as the underlying rectangle. Making any chances to the text (and then "applying" those changes via subtraction) is still difficult if that's the only duplicated object.
    – MBender
    Commented Jul 22, 2016 at 11:36
  • Unfortunately I don't think there's a cleaner, general-purpose way to do it. Grouping your changes in a layer and duplicating/hiding before destroying has the advantage that if you need to change it layer, you don't have to do things like position objects and stuff. Commented Jul 22, 2016 at 12:03
  • A lot of these operations also have keyboard shortcuts, which can speed things up a lot. Commented Jul 22, 2016 at 12:03
0

Make the mask object fully white, no border, works great. Also test with different colors so you can experiment with different results.

1
  • Hi @bobnotbob, welcome to GD.SE :) We try not to leave very short answers here. Can you please add some more explanation/details to your answer? Maybe you can go through an example and include screenshots or a GIF showing what you are doing and why it works. Commented Aug 20, 2018 at 22:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.