1

I have a PNG logo on a transparent background which has areas of pure white (#ffffff) and also pure black in addition to a wide assortment of other colors (logo includes a topo map). Am trying to create a vector image since many places prefer such for inclusion with other logos, etc. This is my first use of inkscape.

Following other on-line procedures, after importing PNG I used 'Select All' and 'Trace Bitmap' with "Multiple scans: Colors: 32", "Stack scans", and "Remove background". The white areas still appeared white - but when I saved as a SVG and examined with editor I saw that the graphic is still included. (I had been expecting it to be removed with selection of "Remove background"). I used an editor to remove the graphic section, but found the resulting SVG then displays the original "white" areas as transparent, not white.

I tried many different variations hoping to stumble up something which which fix this behaviour, i.e. treat "white" as an actual color to be traced ala all the other colors - but could not find anything that worked.

Finally I altered the PNG being imported to replace all its "white" #ffffff with near-white #fefefe, thinking that would not be considered "background". But to my surprise, the near-white area was again not traced, resulting in a transparent area.

So cannot find a way to create a vector image from this logo containing "white" (or "near-white") and am hoping some more experienced user can provide a method of doing so.

Jack

PS: white area need to be white so logo can be placed a non-white background

2
  • Hi. Welcome to GDSE. As far as I know there's no way to get Inkscape to trace white areas if you are auto tracing with the remove background setting checked. That option is specifically for the removal of white. It doesn't see a difference between transparent and white. Try editting the image in a raster image editor to change the white areas to something darker, not just an off-white. Then after it's traced, you can then recolour them by changing the fill.
    – Billy Kerr
    Apr 18, 2021 at 8:32
  • .. for the curious.. in Illustrator you cna retain the white.. but it'll be combined with any transparent areas. Like Inkscape, AI sees white and transparency as the same thing - it's all or nothing essentially.
    – Scott
    Apr 18, 2021 at 10:01

2 Answers 2

0

As far as I know, there's no way to get Inkscape to do it the way you suggest. When you use the "remove background" option, Inkscape can't tell the difference between white and transparent.

Here are a couple of simple workarounds:

  1. Trace as you would normally, using the "remove background" option.

  2. After the trace, draw a white filled shape with the Bézier tool (aka Pen tool), to cover all the white areas inside the logo. You may need more than one shape if the logo is complex.

  3. Move the white shape/s to the bottom of the layer stack (Object > Lower to Bottom), then select all the white, plus the traced logo, and group.

Or alternatively

  1. Edit the raster image in GIMP/Photsohop, and change the whites to another unique colour, different from the others in the logo. Not an off-white, but something obvious like a mid-tone grey for example.

  2. Trace in Inkscape, again with "remove background" selected.

  3. Select the areas which should be white, and set the fill to white.

5
  • Tracing not easily done since logo is 14 outlined letters (with a topo map background inside each outline). So I will try the second option. To be clear, I must use "remove background" since if not done it gives a rectangle of white, eliminating the transparent area. The tool appears to not be alpha-aware. Or may try creating a white mask from alpha layer in external program, then importing beneath original image - but dunno if both imports will exactly align.
    – Jack G
    Apr 18, 2021 at 16:19
  • @JackG Yes, tracing is not alpha aware. Inkscape just sees alpha as being the same as white. Inkscape has masking capabilities, so that is one possible route. I know you probably don't want to hear this, but auto tracing might only get you so far. It doesn't work well with everything. Sometimes you need to do the work manually, it may be complex, and it may not be easy. It might be better to ditch auto tracing altogether and recreate the logo from scratch.
    – Billy Kerr
    Apr 18, 2021 at 16:32
  • "14 outlined letters (with a topo map background inside each outline)" --- sounds like a pretty horrible "logo" :)
    – Scott
    Apr 18, 2021 at 17:00
  • Logo can be seen at bigsurtrailmap.net
    – Jack G
    Apr 18, 2021 at 19:58
  • 1
    Yeah.. horrible :) Fills are so unnecessary and only detract and confuse.
    – Scott
    Apr 28, 2021 at 6:36
0

Sorry for the tardy response, took awhile to work through this.

Using "method two" from Billy Kerr succeeded after changing the "near-white" to "f7f7f7". Finding the whitest successful value required some experimentation - i.e. the slightly whiter "fafafa" did not work, again giving transparent areas (for 32 colors - I assume this depends on number of colors requested). Also, this result depended upon the "Smooth" checkbox - "f7f7f7" did not work when it was checked.

FYI for others trying method two, I was unable to obtain a successful result (ie. unable to find a successful off-white color) for a different map background with much more subdued colors, near-white in many places (USGS National Map, vice previous USGS Quad map) - going down to f0f0f0 (which was same as some areas of map itself) still gave transparent areas. I also tried using magenta as being very unlike any color in map, but again got transparent areas. So do not think it possible to use this technique with an image of near-white grayish colors, since "removing background" removes more than just pure white, also removing slightly off-white colors. Increasing the number of colors from 32 to 64 gave smaller transparent areas, but some transparent areas nonetheless.

But I was able to produce a successful result for the latter case by using a different method, first using "Trace Bitmap" on the image (without any color substitution), then importing an alpha mask of the image and tracing it, filling with white, then moving it behind all other objects and removing the imported graphic.

I also found that the above method produced a slightly cleaner version of the first, more colorful background (USGS quad map), eliminating some slight off-white streakiness. Again, the basic problem with color separation is that "removing background" removes some near-white colors along with pure white.

Jack

1
  • The problem as i see it is that humans think transparent is a color, but in fact for a computer the model is color+alpha. This means that there is no such thing as transparent color! But rather theres many number of colors that can be transparent. And what color transparent happens to have is purely dependent on the data generator, i mean transparent can be lime green you would never know unless you checked. In this case your much better of separating aplha in a image editor first.
    – joojaa
    Apr 26, 2021 at 7:19

Your Answer

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

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