Remove fill colors from all closed paths

Post questions on how to use or achieve an effect in Inkscape.
pppoposition
Posts: 3
Joined: Sun Aug 19, 2012 7:46 am

Remove fill colors from all closed paths

Postby pppoposition » Sun Aug 19, 2012 8:11 am

I have an (apparently) black and white eps image with many small paths which are often interlaced with each other. Some of them are closed and filled with white color while some of them are open. It is also possible that some of the closed paths are filled with a color very similar to white, but not exactly white (e.g. #fefefe). Also, some of the closed paths might not be filled at all. I can not tell exactly, because there are so many paths in this file that it would be very time consuming to examine them one by one.

I would like to "standardize" this image by clearing the fills of all the paths and leaving only the background color. Also, I would like to "standardize" the path stroke color. So far, all the paths I have checked have black stroke color. But there might as well be paths with "almost black" stroke color (something like #010101). In this case, I would like to set the stroke color of all the paths in the image to black.

Is it possible to do something like that in Inkscape?

Thank you in advance for any help!

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

Re: Remove fill colors from all closed paths

Postby druban » Sun Aug 19, 2012 12:01 pm

I wonder if this is too simple a solution, but could you not select all (ctrl-A) and then clear the fills either by clicking 'X' on the palette or, in the fill and stroke dialog, choosing 'no fill'?
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: Remove fill colors from all closed paths

Postby brynn » Sun Aug 19, 2012 3:18 pm

Image
Welcome to InkscapeForum!

Yes it's possible, and druban's solution should work, if everything in the image is to be edited. I'm not clear if you want them all filled with white, or left transparent. If they are to be all filled with white, then you could just click white on palette (after selecting all with Ctrl + A), instead of removing the fill (X on palette) and then replacing it. Not that 2 clicks is all that much harder than 1 click :) And you could set all the black strokes in the same manner, and without deselecting, by Shift + click on black in the palette (or F/S dialog).

But if there are other objects besides the black and white ones, the selection would be a different procedure. Rather than give the various selection techniques, I'll wait to hear whether they will be needed or not. :D

pppoposition
Posts: 3
Joined: Sun Aug 19, 2012 7:46 am

Re: Remove fill colors from all closed paths

Postby pppoposition » Sun Aug 19, 2012 4:12 pm

Thank you both for your answers. I am sorry that I didn't make myself clear in my first post. I also have problems with selection.

I didn't realize it is that simple to remove a fill color and to set a stroke color. Setting of the stroke color for all objects works perfectly as you suggested, because there are no other colors in the image, just black and white (apparently) and all the paths seems to have the stroke color similar to black. But I still have issues with unsetting the fill color.

The problem is that some "bolder" lines in this picture are actually closed paths with black (or almost black) fill color. And if I select all the paths in the picture and clear the fill color, it also clears the black fill color of these closed paths which look like bolder lines.

So, yes, I need some kind of "clever" selection technique, which selects all the paths with the fill color of white or almost white, based on some allowed threshold. Is that possible with Inkscape?

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

Re: Remove fill colors from all closed paths

Postby brynn » Sun Aug 19, 2012 9:21 pm

Hhmmm....no, Inkscape doesn't have a select by color feature. Are you sure that they are filled with blackish color? Could they perhaps have path width so large that fill can't be seen. If that's the case, you can continue, and use the same procedures mentioned. But if they truly are blackish fills.....that will complicate the selection.

If there are relatively few, you could simply hold Shift key, and click once on each one, thereby selecting only those with blackish fills. Or if they are located in one area of the image, you could use the selection box, or so-called rubberband selection. If you accidentally select some with white fills, you could then hold Shift key, and click once on each white fill that was accidentally selected. This will leave the blackish fills selected with white fills deselected.

If there are too many to select individually, and/or not restricted to a small area, you might be able to use Edit menu > Find dialog. With that, you can sort of select by color, but I think you need to know the exact color code. I'm not very familiar with using Find dialog. Here's manual info: http://tavmjong.free.fr/INKSCAPE/MANUAL ... elect-Find. Actually you could look at that whole page on different selection techniques. You may find a particular technique, or combination of techniques, that will work. I see that "Touch Selection" looks interesting, which I was unaware of, until now.

If this is a selection that you might need to make more than once, it might make sense to go the tedious route for the first time, and then do something to make them easier to select next time. For example, you could Group them, so that selecting any one of them will select all of them. Often if I have a lot of little things to select, I will use a combination of techniques. Some of them might only be selectable by single click. But using Shift key, you can make a multiple selection, and keep adding to the selection, one-by-one. Then after I have say 10 little objects selected, I'll Group them. After a while, now I might have 5 Groups of 10 objects (or 10 Groups of 5, or whatever). Then I can group the groups. Or maybe I can use selection box around 3 that are close together in a corner, hold Shift, and click on a couple more. Whenever I have several selected, I could group them.

Or since it sounds like they will have the same color, and/or other style attributes, you could even Combine.
Or you could move them to another layer. Then the next time you need to select them, you can hide the other layers.

Or, I'm sure that druban or others will be along with some other tricks, before too long :D

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

Re: Remove fill colors from all closed paths

Postby druban » Sun Aug 19, 2012 9:31 pm

It's the 'almost' that's going to be a problem... !
Still, since Inkscape can select by color, if you have objects that are 'almost white' filled, you can select one, open the fill and stroke dialog, and in the fill tab copy the hex color of the object, the box on the right that contains a code like "fefefeff". Then in the find dialog paste this in the find field. You will have to delete the last two characters! or this won't work, because although Inkscape shows RGBA in the GUI, in the SVG it separates the color and opacity. Now if you pick the right options, all objects that use this color will be selected when you 'find'. You can have Inkscape automatically replace their fill with white, that is in the replace box you can enter ffffff. In the next step 'find' all objects that use 'ffffff' and then set their fill to nothing.
As another example, if you enter fill:#f in the find field Inkscape will select objects with a fill color of fefeff, ffefff, feffff, fdeacb, f11100 etc. so carefully choosing search terms can do some nice selecting....
Not terribly simple at first but it's pretty intuitive after the first few times!

Off topic:
Edit: I see Brynn has posted while i was typing and she is quite right, Inkscape can't select by color. Inkscape can only find by color name in hexadecimal. Just to clarify and not confuse anyone :D
Your mind is what you think it is.

pppoposition
Posts: 3
Joined: Sun Aug 19, 2012 7:46 am

Re: Remove fill colors from all closed paths

Postby pppoposition » Sun Aug 19, 2012 11:43 pm

Yes, I am pretty sure that I need to keep the blackish fills (i.e. they are not just overlapping strokes). I was, however, able to select all paths containing pure white fills with find tool. Thank you for mentioning that, it seems quite useful.

However, it would be too complicated to search for all the "almost" white fill colors in the image using find. Inkscape should really add support for the "weak" selection by color.

I have been able to "resolve" a problem with my particular image - I unset all the pure white fill colors. Fortunately, it seems that the picture looks good even with the "whitish" fills kept in place.

But still, it would be nice to have a generic way of selecting objects by their approximate fill / stroke / other color. It should be easy to implement, because there already is similar (exact) functionality provided by find.

Nevertheless, thank you all for your answers!


Return to “Help with using Inkscape”