Stuck vectorizing a bitmap

Post questions on how to use or achieve an effect in Inkscape.
hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Stuck vectorizing a bitmap

Postby hgdagon » Wed Apr 02, 2014 1:52 pm

Okay, I'm a newbie to this whole vectors world. So I need this Labyrinth texture in vector format. It's got a lot of "half-circles" and "quarter-circles" (as you noticed, My English s terrible :roll: ).

So I "manually" created the path (in Photoshop), but I had problems with aligning the thickness of lines, so switched to InkScape.
As a result the lines are not proportionate.

This is the original image
Image

This is what I ended up with
Image

And this to actually show how many nodes I have. (Sorry, I don't know if there's any other way to this)
Image


So how can I have lines of even thickness?

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Wed Apr 02, 2014 6:59 pm

Hi.

That's a tough one to start learning vector graphics.
What do you need it for?
It may be easier to re-draw this with a stroke than a filled path, though the corners and line ends would look a bit off with the current style options.
Oh wait, that original image doesn't have those right too.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Stuck vectorizing a bitmap

Postby ragstian » Thu Apr 03, 2014 4:04 am

Hi.

This one will teach you a lot of Inkscape operations!!
It is a challenge but entirely possible for a beginner.
Here is what I would do trying to "convert" the image to vectors.
All operations are "manual"

First start Inkscape.
Set page properties to 800 x 800 pixels.
Place a guide line horizontally in center of image.
Repeat for a vertical guide.

Import the labyrinth image.
Scale the image to 650 x 650 pixels.
Center on image by using the align tool, eyesight is not accurate enough.
Create a new layer called "background" below current layer
Move image to background layer. Shift+PGDN
Set transparency for background layer to 50%.
Lock the layer.

Go back to Layer 1
Draw a circle centred on page (click and hold on middle of image, press CTRL+SHIFT and drag at a 45 deg angle to draw a circle )
Set circle stroke to 10 pixels.
Set circle fill color to none.

Draw another circle 175 x 175 pixels centred on page, 10 pixel stroke, set same stroke and color as first circle
Select both circles and do a "stroke to path" CTRL+ALT+C.

Select both circles and pull-down the extensions generate from path - interpolate.
set interpolate steps to 9 - "untick" the duplicate endpoints and press apply.
You will now have 11 circles on the canvas.

Now it's time to create a new layer called "Boxes" above layer "Labyrinth"
Switch to the Boxes layer.

Set snapping "on" (select all the snapping options on for now)
Draw a horizontal line between the centers of the vertical borders.
Set line width of the drawn line to 10 Pixels.
Convert the line stroke to path. CTRL-ALT-C
Duplicate the line (now a path object) twice CTRL-D
Align the lines horizontal edge to horizontal edge.
Set the two outer lines to a different color.

Group the three lines. CTRL+G
Duplicate the lines. CTRL+D
Rotate the duplicated lines group 90 degrees (using the rotate icon along the top of the Inkscape window)

Create four more helper boxes along the bottom part of the helper boxes.

If you have followed this so far you will have something like this;
Image
Click Image for larger version.

To be continued. (Chores coming in the way ;)

Here are the SVG file to play with;
Labyrinth.svg
(159.83 KiB) Downloaded 195 times


If you want to have a go; the rest is just path operations between circle and boxes.
The easiest is to select two paths (circle and box) and do a "Division" CTRL+/

Then break apart the paths and join at appropriate places.
When done - remove the background image to get the size of the SVG file down.

Good Luck
RGDS
Ragnar
Last edited by ragstian on Thu Apr 03, 2014 11:16 am, edited 4 times in total.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Thu Apr 03, 2014 10:43 am

@ragstian
Thanks a lot. Looks pretty hard,thus challenging. Will try it that way too. But the original image resolution is 384x384, so 800x800 would be stretching. That shouldn't be a problem, right?

@Lazur URH

Thanks a lot for the quote. That's probably the inspiration I needed))

I'm doing a fan re-texture project for a game. This is one of the textures and it should be fullscreen in-game. I tried resizing and applying filters, it looked quite decent, but I wasn't really happy... So I was messing with vectors, and thought maybe I can use vectors here too? It IS a shape, after all...

I started from scratch since the first time I did it this way
Image

This time I decided to it this way, in order to get perfect circles (I deleted the six small circles in the center, when I switched from Photoshop to Inkscape, since they should've had a common point and couldn't reach it this way)
Image

And here's how it looks now. Only some minor tweaking left to be done.
Image

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Stuck vectorizing a bitmap

Postby ragstian » Thu Apr 03, 2014 11:21 am

Hi.

Perfect!! Well done!
The original size does not matter, you can always scale down when exporting to bitmap.
Just be aware of "bit-boundarys" (do a search on this forum) when exporting.

Mission accomplished?
RGDS
Ragnar
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Thu Apr 03, 2014 11:58 am

So it's not for a cutter/plotter. In that case ways to draw that doubles at least.

Like, you don't even need to do any booleans as subtracting,
the image can be made by smaller paths above concentric circles.

Another way would be to use spiro-paths over previously drawn guiding paths, with snapping, to draw the black line as one over a white shape.

Ragnar's method leads to the "best" path you can get, but there are so many small details in it, how to go on with the rest, in an accurate way, that would take forever to demonstrate.

Seeing your current work in progress, I will post examples for what I mentioned here.


Edit -svg added-
First example is how a lazy person would do that.

SVG Image

Cheap solution 2:

SVG Image

tylerdurden
Posts: 2344
Joined: Sun Apr 14, 2013 12:04 pm
Location: Michigan, USA

Re: Stuck vectorizing a bitmap

Postby tylerdurden » Thu Apr 03, 2014 12:49 pm

That's a nice workaround... "lazy" ain't all bad.
Have a nice day.

I'm using Inkscape 0.92.2 (5c3e80d, 2017-08-06), 64 bit win8.1

The Inkscape manual has lots of helpful info! http://tavmjong.free.fr/INKSCAPE/MANUAL/html/

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Thu Apr 03, 2014 1:12 pm

@Lazur URH
I got something similar with "Bitmap trace" it looked good but hell of a lot of points.
Anyway, I'm definitely not lazy. The harder the better. Just for experience...

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Thu Apr 03, 2014 9:16 pm

I see.
I tend to work that way too but this time it seems the original image was made with an effort to be time efficient.
See the white wall's ends. They are not horizontal/vertical lines, rather lay in a radial direction.
That looks exactly as the original wasn't made with a closed path and a white fill, but as a compound path with no fill but white stroke.

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Fri Apr 04, 2014 5:26 pm

ragstian wrote:Draw a horizontal line between the centers of the vertical borders.


I feel incredibly stupid, but how the hell do we draw lines in InkScape?

Also I have no idea how you guys embed the svg's when posting, so here's where I am now.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Fri Apr 04, 2014 8:54 pm

I belive that "line" was referring to path made with the pen tool.
(As far as I know although svg has a "line" type of object, those are used only by the connector tool inside inkscape.)

Some notes:
The spikes as you drew them -made up by "separate" triangles- could be much cleaner by using the star tool instead (*).
That way you could reduce 75 nodes -if it was converted to a path.

Don't know how exactly made those circles, but it all could be made more accurate.
A bit about the implementation: the bézier paths used can't produce accurate circles.
All objects, including the ellipse tool are made with those inside inkscape.
By converting them to paths, they will turn to be paths with four smooth nodes.
In the development builds this has changed: it is affected somehow by the size of the inaccuracy, there they may have more nodes.

So the concept is, nodes can be placed in accurate positions.
The more nodes you have, the closer you can get to a geometrically correct form.

To add a twist, there are two kind of paths inside inkscape: regular ones, and spiro-paths.
These spiro-paths connect nodes with circular segments -if curved-.
They are not part of the svg specification, so if you save a spiro-path in plain svg, it will turn to have more nodes, just as the mentioned new circle converting behavior.
They are implemented as live path effects, by pressing Ctrl+Shift+C, they will be converted to regular paths.

To draw the white parts, I would suggest to use spiro-paths, as with regular ones, you could hardly make arches in an accurate way.

But to be more confusing, I would use a guiding object to do that made by regular paths.
Because of the mentioned inaccuracy, to draw one circle, I would use a polygon made with the star tool (12 nodes), converted to path, and change it's nodes to smooth ones.
Once you made one circle alike, you can use the duplicate option (Ctrl+D) to use it more times.

In this case, scale it to the inner-most and outer-most circles of the original raster image,
open the align and distribute panel (Shift+Ctrl+A) and center align those two.
Then combine that two together (Ctrl+K), and set a live path effect: interpolate subpaths.
If the result doesn't look quite right, that is because somehow the starting and end nodes of the subpaths are messed up.
To correct that, there is an option with the node tool to split nodes -make two open paths that way, so the effect will be applied between the nodes right.
-Actually this problem is presented in the interpolate extension too, as there nodes get split immediately in interpolated paths inbetween. See on Ragnar's example, how the circles with 8 nodes turn to have 12 nodes there.-

After that, would come drawing the horizontal-vertical "lines".
With the pen tool, holding Ctrl.
The align and distribute panel can come handy here too.

After these, convert the live path effect to a path, and
with the snapping to paths, path intersections enabled, re-trace the right parts with the pen tool, and set right segments curved, nodes smooth, combine paths together, and apply spiro-spiro live path effect.
This step would take the most work but it cannot be explained right, only step by step?
Experience with it.
Circle arches would need two end-nodes and one other node in-between, the two path segments turned to be curved, and the node in-between set to be smooth.

Then could come the inner part made with six small circles.
I would make it similar to the mentioned method here:
http://www.inkscapeforum.com/viewtopic.php?f=5&t=17160#p63039

After that, it could be retraced with spiro-paths.

You may ask why not to simply add those together (Ctrl++)? That is because, such boolean operation has a 0,02 inaccuracy, and can add that to all the path's nodes.
The reason why making this with a white filled path so challenging.

After these, you would need a black circle for the background, and a spiky path below it.
You can use the align and distribute tool once circles/stars are scaled up.
Preferably with the star tool, draw the 80 spikes while holding down Ctrl, so it will be rotated into position.

Adding that cut at the bottom again could be done in seconds, but harder to be explained.
After converting the star to path, I would draw two rectangles, both having one side atop those segments -with the snapping option-, scale them up proportionally, then could edit the star -snap it's node to the triangle's intersection.

That would be it. Hope the details are clean.

I embedded image from dropbox, don't know if mega has the option to that.
Once you have the svg's url copied, paste it between

Code: Select all

[svg][/svg]
tags here an it will be embedded.
Good luck!
Last edited by Lazur URH on Mon Apr 07, 2014 11:49 pm, edited 2 times in total.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Stuck vectorizing a bitmap

Postby ragstian » Fri Apr 04, 2014 10:40 pm

Hi

To draw a strait line;
use the pen tool :tool_pen:
click and hold the LMB (Left Mouse Button)
move mouse pointer to end of line position
release LMB.
double click LMB.

Holding down CTRL key while moving mouse will give you a line
that snaps to any 15° incrementes (including horizontal and vertical, this setting can be changed in preferences)

A very well made beginners guide; http://www.microugly.com/inkscape-quickguide/
Line video guide; http://www.youtube.com/watch?v=GhnBdki0Ltg

Good Luck
RGDS
Ragnar
Last edited by ragstian on Sat Apr 05, 2014 2:55 am, edited 1 time in total.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Sat Apr 05, 2014 12:53 am

Lazur URH wrote:The spikes as you drew them -made up by "separate" triangles- could be much cleaner by using the star tool instead (*).
That way you could reduce 75 nodes -if it was converted to a path.


Actually, starting from the first day I used Star Tool to draw the spikes :tool_star: . But later I convert it to path.
Another thing is that all your examples are good, but I need to have "White on Alpha" So I don't need any black AND I have to convert the Star to path. Also there are actually 79 nodes in the Star/Sun.

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Sat Apr 05, 2014 12:57 am

ragstian wrote:
To draw a strait line;
use the pen tool :tool_pen:


Yes , I tried that one. But you also said "Set line width" and when trying to set the width of the line I only got it skewed.

ragstian wrote:click and hold the LMB (Left Mouse Button)
move mouse pointer to end of line position
release LMB.
double click LMB.


This one's really useful, thanks. I didn't quite understand how it worked at first.

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Sat Apr 05, 2014 1:01 am

hgdagon wrote:...Also there are actually 79 nodes in the Star/Sun.


Because one spike is cut off at the entrance.

It is a matter of editing those to have it as a white stroked path over a transparent (black) background.
Can combine those together, unconnect, connect unconnected nodes here and there.

User avatar
ragstian
Posts: 1181
Joined: Thu Oct 11, 2012 2:44 am
Location: Stavanger-Norway

Re: Stuck vectorizing a bitmap

Postby ragstian » Sat Apr 05, 2014 2:59 am

Hi.

Hgdagon;
Yes , I tried that one. But you also said "Set line width" and when trying to set the width of the line I only got it skewed.


The line width is set in the "Fill and Stroke" (CTRL+SHIFT+F)
Use the stroke style tab and set line width.

For beginners it's always an advantage to go through some of the basic operations tutorials before starting on "advanced" projects;
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/
Go through the "Quick start" here, you will be an expert in no time!

I can recommend buying the book, I find something "new" every time I open it.

RGDS
Ragnar.
Good Luck!
( ͡° ͜ʖ ͡°)
RGDS
Ragnar

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Sat Apr 05, 2014 4:09 am

This one was made as described above:

SVG Image

Don't know how, but there was about a 0,2 px difference between the spiro arch segments next to the original circles with 12 nodes.

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Sat Apr 05, 2014 4:07 pm

Lazur URH wrote:SVG Image


Thanks, this one's looks exactly like what I need. Will try to do the same thing.

Lazur URH wrote:Don't know how, but there was about a 0,2 px difference between the spiro arch segments next to the original circles with 12 nodes.


If I understood it correctly, it wasn't 1:1 radially proportional to the original, I think it's ok, 'cause I've stretched it. the original was an oval texture (square sized 512x512) that was being stretched to wide in-game. (1024x768, etc.)
Last edited by hgdagon on Sat Apr 05, 2014 4:11 pm, edited 1 time in total.

hgdagon
Posts: 11
Joined: Wed Apr 02, 2014 1:26 pm

Re: Stuck vectorizing a bitmap

Postby hgdagon » Sat Apr 05, 2014 4:09 pm

ragstian wrote:For beginners it's always an advantage to go through some of the basic operations tutorials before starting on "advanced" projects;
http://tavmjong.free.fr/INKSCAPE/MANUAL/html/
Go through the "Quick start" here, you will be an expert in no time!


Thanks will go through the Quick Start (and some other chapters, that look interesting) right now. 'Cause it lloks like Im asking too many stupid qustions :roll:

Lazur
Posts: 4717
Joined: Tue Jun 14, 2016 10:38 am

Re: Stuck vectorizing a bitmap

Postby Lazur » Sun May 31, 2015 2:07 am

Recently I have drawn a similar, Chartes inspired labyrinth:

SVG Image

-one path showing the only path, with no fill but stroke-

(for dailysketch 22)


Return to “Help with using Inkscape”