How to convert raster image to vector SVG for Inkscape ?

Post questions on how to use or achieve an effect in Inkscape.
paul481
Posts: 25
Joined: Sun Apr 17, 2011 2:30 am

How to convert raster image to vector SVG for Inkscape ?

Postby paul481 » Fri Sep 02, 2011 6:29 am

I have some raster images of maps. How do I accurately convert them to vector SVG for Inkscape ?

Thankyou in advance

PatJr
Posts: 81
Joined: Fri Jul 29, 2011 5:35 am

Re: How to convert raster image to vector SVG for Inkscape ?

Postby PatJr » Fri Sep 02, 2011 7:06 am

yikes! I think your best bet is to redraw them.

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

Re: How to convert raster image to vector SVG for Inkscape ?

Postby druban » Fri Sep 02, 2011 7:33 am

If you do some searching in this forum you will find that there is a lot of help and info from people who are doing exactly that - converting raster maps to vector SVG. It's fairly easy to do.
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: How to convert raster image to vector SVG for Inkscape ?

Postby brynn » Fri Sep 02, 2011 10:49 am

In general, there are a couple of ways to approach it. One would be to use Path menu > Trace bitmap. There is quite a learning curve, it seems, for most users, including me. So if time is a factor, you might want to go with the other approach :D

And the other way is to trace it by hand. You would open Inkscape, import the map, add a new layer, and draw on the new layer, directly over the map. Usually folks who do this (again including me) prefer to reduce the opacity of the layer with the original, and so it's just like tracing the map on tracing paper (except the Inkscape pen takes some practice....however for me, much less than with Trace bitmap).

And as druban suggested, you can find more detailed tips by searching the forum. One recent topic is entitled "Carbon Paper". And there's another very recent one, but I can't remember the title. But if you search with "map" you should find it quickly....or....rats, I can't remember.....I think it might have been a map of Tanzania, if the "map" search returns too many results. Or Mediterranian....? (My brain seems to be much older than the rest of me, lol Image)

paul481
Posts: 25
Joined: Sun Apr 17, 2011 2:30 am

Re: How to convert raster image to vector SVG for Inkscape ?

Postby paul481 » Sat Sep 03, 2011 1:13 am

ok, many thanks for those suggestions, will follow them through. Interesting to see 2 observations, one saying easy to do, the other pointing out significant learning curve with either method. In case it affects the choice between the 'Trace bitmap' or manual trace on overlay, the initial bitmap I want to convert is a simple town plan (a small part of) long sequences of black lines, polygons etc on white background.

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

Re: How to convert raster image to vector SVG for Inkscape ?

Postby druban » Sat Sep 03, 2011 1:50 am

In most cases i would recommend using trace bitmap and then editing the result with the node tool and the simplify command rather than trying to draw by hand over a template. Do you have a graphic tablet and stylus type input device? This greatly helps when manually tracing from a raster source. A black and white source with straight lines should autotrace very nicely...
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: How to convert raster image to vector SVG for Inkscape ?

Postby brynn » Sun Sep 04, 2011 6:26 am

I didn't mean to imply a significant learning curve with either method. For me, it took much longer to get a handle on Trace Bitmap. Since you've been using Inkscape for a while now, you may already have the skills to use the Pen, and not have any further learning necessary.

Also, part of this choice is a matter of personal preference. And it depends on the map itself and the complexity of both the original, and the intended result.

Since you said "accurately convert" and most maps don't have straight line borders, I think tracing by hand would achieve the best results. But if I submitted my hand traced results alongside druban's Trace Bitmap results, you might not be able to see any difference. He may have amazing skills with Trace Bitmap, and I may have amazing skills with hand tracing.

Maybe you could do a quick test with one state/country/county, or whatever, and decide which technique suits you best?

paul481
Posts: 25
Joined: Sun Apr 17, 2011 2:30 am

Re: How to convert raster image to vector SVG for Inkscape ?

Postby paul481 » Tue Sep 06, 2011 7:38 am

Sorry, I am a long way from internet access, so prepared this reply at base and took it to a cybercafe for upload. I see since my logon last Friday some further input. My facilities are limited to source streetplan on paper and a digital camera I used to get a digital copy.
Over the weekend made progress using your suggested 'Trace bitmap' using the defaults (Single scan) which successfully converted my simple streetplan to a SVG that was a big 1.2MB file containing 1 object of 10312 nodes. Took less than 1 second to convert. The SVG version is also black lines on white background and visually is near perfect reproduction of the 170KB JPG source. So step 1 achieved. However, as a step 2, I want to be able to edit the logical objects (5 streets containing a few hundred buildings) in the SVG version, eg. convert text to the more efficient SVG Text object type, convert some buildings to simple rectangle objects, perhaps add fill colours to some buildings.

I was thinking the next step is a further conversion, from a single 10,312 node object down to a few hundred separate objects. I am also thinking even if this also results in a perfect rendition, the possible 10,312 objects produced, may be too big a job to edit to reduce the 10,000 objects down the few hundred buildings shown on the Street Plan ?
It also occured to me now, maybe I should have tried preprocessing the source JPG to present an easier task for Trace Bitmap to use. However, when I used Irfanview to reduce the default 16k colours in the 'black&white' greyscale source to 2 colours, sharp then blur, remove dithering; Inkscape then produced 12.391 nodes - bigger than before, so that did nt help.
Another thought: I used the Default Single scan parameters, and default option values. As this is 2-black&white line-drawing, any suggestions for alternate settings in the Trace Bitmap dialog ?

I am now thinking unless I can find a way of automatically reducing the number of nodes while preserving rendition quality, maybe the 'Carbon trace' method suggested before is more efficient ?

Thanking you in advance.

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

Re: How to convert raster image to vector SVG for Inkscape ?

Postby brynn » Tue Sep 06, 2011 5:27 pm

Ah, a street map! I was thinking country or even world map Image

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

Re: How to convert raster image to vector SVG for Inkscape ?

Postby brynn » Tue Sep 06, 2011 6:08 pm

There IS a way to reduce the number of nodes -- Path menu > Simplify. But what I think you will find is that the more you click it, the fewer nodes are removed each time. And also, you'll start to see corners which appeared to be sharp, are becoming rounded. And in reality, if you zoom into a sharp corner, you'll see that it is indeed rounded.

And now that I know it's a street map, and that you want to include buildings, and other things, I think you may quickly realize that your map might be one large object (of what you said comprises over 10,000 nodes!). If this is the case, it will take some time to break up the large object, and there will be a lot of node editing. Oh ok, that's what you just said in your message, lol. I didn't understand it at first. But you're right, it will take some time and a lot of work!

I'll preview what you'll see, once you get started, if you decide to do that. Have you ever used Stroke to Path? You could have a path with 2 nodes, just a straight line. But after stroke to path, you now have a very long, very skinny rectangle of 4 nodes. If there's a little bit of a curve, you might have 8 nodes. Trace Bitmap does something similar to that. If you had a straight line in your raster image, Trace Bitmap probably produced, not an open path with 2 nodes, but a closed path with.....depending on the quality of the original, maybe up to 10 or 20 nodes. Well it's hard to describe, but I think it would be a really lot of work to break up the automatically traced image into it's components as shown on the original.

Inkscape CAN handle such a project, especially if you use layers. But there might be a way you might make the current single object work :D You could use the Paint Bucket tool to fill in color to each defined space. You won't have individual objects. But if what you want is a reproduction of the original map, you won't need to move them around. Right? I'm wondering if you could just apply color to what you have already? And that's exactly what the Paint Bucket tool is designed to do. One drawback is that you will eventually, probably, nearly double your nodes.

Hand tracing (a la the "Carbon Paper" topic) will result in far fewer nodes, and many individual objects. So if ultimately you want to be able to move your individual buildings, etc. around, I think this would be the better option. But if they don't need to move things, you could add color as mentioned, and use your existing autotraced image.

And again, the choice is yours! Good luck :D

paul481
Posts: 25
Joined: Sun Apr 17, 2011 2:30 am

Re: How to convert raster image to vector SVG for Inkscape ?

Postby paul481 » Sat Sep 17, 2011 6:29 am

brynn wrote:There IS a way to reduce the number of nodes -- Path menu > Simplify. But what I think you will find is that the more you click it, the fewer nodes are removed each time. And also, you'll start to see corners which appeared to be sharp, are becoming rounded. And in reality, if you zoom into a sharp corner, you'll see that it is indeed rounded.

And now that I know it's a street map, and that you want to include buildings, and other things, I think you may quickly realize that your map might be one large object (of what you said comprises over 10,000 nodes!). If this is the case, it will take some time to break up the large object, and there will be a lot of node editing. Oh ok, that's what you just said in your message, lol. I didn't understand it at first. But you're right, it will take some time and a lot of work! ......

And again, the choice is yours! Good luck :D


Thankyou so much for your insight into Bit Tracing and the way it creates lots of nodes. From this I am convinced and manual 'tracing paper' using layers is the best method for my application. I will now go lookup the Carbon Paper topic you recommend.

No, I haven't got round to using 'Stroke to path' or understanding the relationship between 'Nodes' and objects - have a vague understanding, but seems an 'advanced topic' for someone relatively new to Inkscape.

I think my next learning curve could be on relating a 'Plan view' to a 'Elevation view' of a drawing. Not really thought about it yet, but I would like to be able to represent an individual building, along with its floors, stairs, roof area, in both planes, and rather than an intelligent aproach, was just thinking to copy any relevant objects eg outer-walls, over to the new drawing (prob in a new Layer, now am familiar with them) to get the scale and registration right, then edit the copied objects to show their vertical component. Welcome references to any general articles or observations on that.

Still no internet local to my home, so sorry for the delay.

Thank you again for your help.

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

Re: How to convert raster image to vector SVG for Inkscape ?

Postby brynn » Sun Sep 18, 2011 7:30 am

Layers should certainly work for your "elevation view" of a building. I don't know of any tutorials or articles. But I guess I would just duplicate the outer walls for as many floors as needed, then use Shift + PgUp or PgDn to move the duplicates to new layers (which were created previously).

I'm not sure what you mean about "edit the copied objects to show their vertical component". Do you mean that you want to create a sort of 3d effect, something like you can see in Google Earth, for example. Not true 3D, but so that the height is evident? For that, I think you'd just need to be very clever with highlights and shadows, which is definitely intermediate to advanced level stuff. Certainly not unattainable, and I don't mean to discourage you.

Are you looking to make a top down view of a building, except with xray vision so that you can see through the roof and floors/ceilings? So just thinking aloud, the top floor would need to be slightly smaller than the one below it? So it sounds like you would want to select everything in each layer, and scale them slightly relative to the one above or below. I guess if they're strictly line drawings, highlights might not be relevant, but shadows might?

That sounds like an interesting challenge. It's similar to this member's project, and inspired by it, a similar one that I'm currently working on, except yours is with buildings, and ours is with landscape (viewtopic.php?f=9&t=9734)! I'm still drawing my basic "map" and haven't started with the actual coloring, shading, and trying to create height from a top down view. I like to enjoy the ride!


Return to “Help with using Inkscape”