4

I'm trying to convert (trace) this image to an svg file:

enter image description here

Full size Image

I run Path > Trace Bitmap, 256 colors, no smooth, no stack, remove bg, no optimize paths. It vectorizes ok but the colors are changed slightly, which can't happen, since the rgb of the fill is essentially the ID of the shape, which means I can't map from svg -> the webpage.

It won't let me go over 256 colors either, and there's roughly 4k+. Is there a way around this limit, or is there another program I can also use?

Edit: The problem isn't so much the tracing, but the specific colours:

province red green blue x hex 0 1 128 34 64 Stockholm #802240 1 2 0 36 128 Östergötland #002480 2 3 128 38 192 Småland #8026c0

enter image description here

On my resulting images, those hex colours don't match to the ones I have on file (and what they are on the original .bmp)

9
  • The image has to be huge for that kind of separation to work out. I gather the file has no AA?
    – joojaa
    Dec 5, 2017 at 12:20
  • Yeah unfortunately the image is 33mb, not sure what they're thinking with it but it's the only source I have for the info I need
    – paimoe
    Dec 5, 2017 at 12:51
  • 1
    I can't replicate the problem. Illustrator's image trace can handle many more colours than 256. When I trace it, the result is 5728 colours. see screenshot here
    – Billy Kerr
    Dec 5, 2017 at 13:02
  • I'm having the same thing as Billy Kerr. I would suggest that you consider using illustrator for this project - my results
    – Welz
    Dec 5, 2017 at 13:04
  • @WELZ - just noticed the OP asked for Inkscape, LOL
    – Billy Kerr
    Dec 5, 2017 at 13:05

1 Answer 1

3

AFAIK the vectorization process in inkscape is just a color quantization + n call to potrace. I guess the color reduction first stage is done using median-cut algorithm which is prone to color quantization error.

So I think you won't be able to preserve the colors while tracing in inkscape.

Maybe you could try the script @ http://www.inkscapeforum.com/viewtopic.php?t=30972

which is a shell script that uses imagemagick to sort the colors by area in your image and then launch a potrace on a mask for every color then combine the n svgs.

2
  • I do think that may have done the trick - gave me an svg with the correct colours, I have to go through and group up some of them that are related but no biggie - will accept afterwards
    – paimoe
    Dec 5, 2017 at 17:42
  • Marking this as accepted, because it did what the question needed, to build an svg while keeping the colours perfect. Thanks
    – paimoe
    Dec 6, 2017 at 20:25

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.