[need help] Tracing raster-to-vector process


(Stefan Chirila) #1

I have created a logo for a project I am working on and I am looking to turn the raster image into a vector with as much detail as possible. Before you get upset with how silly my plan is, please keep in mind it may be silly but it is something I am workingon and I am only asking if anyone has had similar experience and is able to help.

The initial file is something in the vicinity of 3000px by 6000px and comprised of 4 sections, two of which black and white, and two in colour. Basically this, but without the camera and other stamp in the middle:

I applied the “Dream” effect via G’MIC in Gimp in order to make it more stylized and have played with the contrast a tad as well as reduced the overall number of colours in order to give the tracing program an easier time.

My experience:

I began with Inkscape but the max number of colours was 64 and the image ended up traced and given a yellowish cast.
My second try was Autotrace which performed better. The colours are more accurate, if a little on the pale side, allowing for up to 200ish of them. Strangely, the black and white areas display colour areas here and there. I still need to tweak the tones in order to figure out which details I want to keep and which not …but the main issue I am encountering is this: random transparent bits here and there in the image. I’d like to know how I can get rid of them. I assumed they had to do with the background, white, and therefore tried to darken the high end and avoid pure white altogether but am still getting them.

If anyone has any ideas, I will post the command line arguments mix I used and send a sample out as soon as I get home today. Please help!

(Mica) #2

Your vector can contain raster images, which is the easiest route.

If not leaving the images as a raster, I’d posterize each image in order to give the tracer an easier time. I’d get rid of the logo type (the white part) while tracing.

I’d also just hand trace the white part of the logo, as that should be easy.

(Pat David) #3

Could you run the trace against each source image portion separately? It might help to only have to focus on one subject at a time. You could consider changing the whites or transparent problem areas out for another color, and then go back and modify it in the source svg after-the-fact? Heck, you can probably just find/replace the alpha portions entirely through the output SVG, now that I’m thinking about it (isn’t it the last two octals in the hex for the color?).

(Stefan Chirila) #4

as mentioned above @paperdigits, the white parts are not part of the thing i am tracing. they are vectors themselves and I intend on applying them later. it’s just the images. No unfortunately embedding the raster into a vector would not serve the purpose, I want to literally turn them into vectors - so each line to be a vector, each curve, each shape :stuck_out_tongue: I’m a weirdo I know.

(Stefan Chirila) #5

@patdavid yeah I’ll try to scale up the individual quadrants and trace them individually then mix them together.

Any idea why the black and white areas are mostly black and white, with occasional colour blotches? :frowning:

(Pat David) #6

Nope - no idea. If you know what they are supposed to be, it should be a quick and easy find/replace in the SVG though. (Feel free to upload it if you want a hand with it.)


I made some logos in the past for fun and free. I am by no means experienced with Inkscape but here are my thoughts.

I found that tracing the raster manually is the easiest way to get the job done. It might be tedious but it actually saved me a lot of grief. You could do a bit of both if you aren’t comfortable with that. Just as we can use layers in GIMP, we can take advantage of layers to cover or blend less satisfactory parts. From an auto-trace, you can always modify, delete or simplify the paths and nodes, which can help remove those blotches.

As for transparency, there is a setting that you can turn on or off that turns the background color into alpha. Normally this setting is on for whites because it helps reduce unneeded paths or nodes, which is the point of vectorization. When I want some whites to be transparent and others not, I just place a white filled shape at the bottom to cover those areas.

(Stefan Chirila) #8

@afre thanks!

(Stefan Chirila) #9

will upload a sample tonight

(Stefan Chirila) #10

Alright so… here’s what I got so far.

The logo prepared for tracing in Gimp

Here with contrast added:

The traced vector version.

Notice the transparent areas near the eye? SO ANNOYING! :frowning: and I can’t figure out how to get rid of them. I don’t remember having set anything to be used as transparent.

Here is a sample if you guys wanna try your hand at it.

The command I used for autotrace is as follows (I put it together years ago for a different project and can’t remember where I gathered it from):

$ autotrace --input-format=jpg --output-file=output_file.svg --dpi=300 --color-count=200 --corner-always-threshold=60 --line-threshold=0 --width-weight-factor=2 --line-reversion-threshold=2 --preserve-width --remove-adjacent-corners 1.jpg 2>&1

@patdavid @paperdigits

(Mica) #11

I wonder if there is a way you can smooth the vector automatically?

Maybe, if you know the largest you’ll print/display it, try interpolating the photograph larger, then do the smoothing & other filters and maybe that’ll be enough… or try tracing it like that. There is of course, no sound theory behind that idea :stuck_out_tongue:

(Stefan Chirila) #12

@paperdigits that is not a bad idea. I applied a lot of the dream effect that small details are washed out, so if i need to print big i over-scale it in reference to what size I actually need, then apply some sharpening. shouldn’t be an issue. but i did want a nice stylized vector though :stuck_out_tongue:

anyway. #firstworldproblems

(Mica) #13

I do understand the “because I want it” mentality, I’ve burned many hours doing that :smile:

(Stefan Chirila) #14

@paperdigits I mean I do logically understand I may never actually use it …having the high resolution raster. But yeah. I excuse myself by saying once I figure it out I’ll make a detailed tutorial for the benefit of the world :open_mouth:


I don’t know where this limit is coming from. I did a trace with default settings and scans = 200.

This results in more than 64 colors. In fact, we have 90209 with no transparency (original had 436023). Not sure about the color cast because my monitor isn’t color calibrated.

(Stefan Chirila) #16

@afre That looks amazing! I don’t know what I did, but I will try it again with the settings I see in your screenshot and post results.

As for the colours, I was referring to the box that says colours (currently set to 8) below the thresholds. Scans I assumed refers to how many times it scans but that colours would be limited to 64. Guess I was wrong.

Also, just out of curiosity, could you please let me know which version number of Inkscape you are running, I’m asking just in case for some reason my Debian might have some ancient version, as it ended up happening with RawTherapee before I upgraded to a different repo :stuck_out_tongue: And I’ll compare once I’m home tonight.

Thank you!


No worries. I am guessing that you selected “Color quantization”, which does indeed have a limit of 64 colors (blue). What you want is “Multiple scans” (red). Also note that 200 scans is overkill.

I have Inkscape 0.92.0 r15299 on my system but certain ancient versions might work just as well. In my opinion, they were more stable and had tools that behaved in a way that I liked.

(Stefan Chirila) #18

@afre will check it out and report back as soon as I get home

(Stefan Chirila) #19

@afre am home and can confirm it works. I’m not sure what I managed to do before …ill post an optimized result :slight_smile:

(Stefan Chirila) #20

@afre sadly look what it’s doing. ugh :frowning:


Here is the large version to try on: