Removing everything that is not black?

Post questions on how to use or achieve an effect in Inkscape.
sepoto
Posts: 1
Joined: Tue May 01, 2012 2:36 pm

Removing everything that is not black?

Postby sepoto » Tue May 01, 2012 2:39 pm

I am new to inkscape and I have a file with two layers. I would like to remove on all layers all objects that are not black. Can this be done?

Thank you,
Sepoto

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Removing everything that is not black?

Postby brynn » Tue May 01, 2012 2:47 pm

Image
Welcome to InkscapeForum!

There's not any way to do that automatically. There is a way to find and delete everything of a certain color, using the XML Editor. But I don't think it could delete everything except a certain color. I don't know, I guess it might be possible to write a script or something, but that's way beyond my understanding.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Removing everything that is not black?

Postby druban » Tue May 01, 2012 5:09 pm

This is really quite easy to do, but the first couple of times might take some practice...
1. You will find it easier if your preferences, in 'svg output' are set to 'use named colors'. (Otherwise you will have to use '000000' instead of 'black'). Very importantly, in your selecting preferences, you must have 'Select in all layers' (the first option) selected!
2. Open the find dialog. CTRL-F. Enter 'black' in the find box. Search in properties. Scope 'all'. Check the 'style' box. Check the 'all types' box.
3. click find.
4. In the edit menu choose invert selection (or press !). Now delete.
0.48.1 find dialog
g2998.png
g2998.png (17.14 KiB) Viewed 2744 times

dev release 11265
g3018.png
g3018.png (30.57 KiB) Viewed 2744 times

Note that this keeps every object that has a black fill or stroke. More complicated to distinguish between the two... but you might not need to...
Last edited by druban on Tue May 01, 2012 6:03 pm, edited 2 times in total.
Your mind is what you think it is.

~suv
Posts: 2272
Joined: Sun May 10, 2009 2:07 am

Re: Removing everything that is not black?

Postby ~suv » Tue May 01, 2012 5:25 pm

druban wrote:This is really quite easy to do, but the first couple of times might take some practice...
4. In the edit menu choose invert selection (or press !). Now delete.

One thing to keep in mind: 'Edit > Find…' searches and finds (aka selects) objects within (potentially deeply nested) groups. Inverting such a selection with objects from various group levels and deleting the inverted selection might produce unexpected results: a workaround (e.g. when working with imported clipart or editing PDF files) would be to move the selection to a new layer (cut, change layer, paste in place) to have the content separated, and then delete (or hide) the unwanted layers.

User avatar
druban
Posts: 1917
Joined: Fri Nov 20, 2009 10:48 pm

Re: Removing everything that is not black?

Postby druban » Tue May 01, 2012 5:52 pm

Just so! In my recent working release of Inkscape the find dialog has a lovely new form, including a 'scope' option that lets you select between 'all', 'current layer' or 'selection' which would alleviate this very problem. (The old dialog had this, too, but I like the new look (see pics above) better...)
But the warning is very apt, ANY global changes made on a multilgroup/nested group complex file is quite risky. Inkscape has many safeguards against such risks, as in the preferences > selecting dialog... Doing it layer by layer seems the safest, unless you are very familiar with the structure of your file.
Your mind is what you think it is.

User avatar
brynn
Posts: 10309
Joined: Wed Sep 26, 2007 4:34 pm
Location: western USA
Contact:

Re: Removing everything that is not black?

Postby brynn » Tue May 01, 2012 8:06 pm

Hhmmm....I thought you had to use the XML Editor to do that. Interesting!

User avatar
nesDk
Posts: 41
Joined: Tue Feb 28, 2012 6:55 am
Location: Denmark

Re: Removing everything that is not black?

Postby nesDk » Wed May 02, 2012 12:34 am

nice druban.
never though of using "find" for anything really usefull, eyeopener.


Return to “Help with using Inkscape”