Many questions have been asked about the general practice of converting rasterized images into a vector format, but this is not quite the same question I am asking.

Specifically, I'm interested in software/algorithms designed explicitly to convert antialiased, two-color raster images that were known to be created from vector images back into a vector format. I am aware of general purpose path tracer algorithms such as the ones that Inkscape comes with, however they tend to do quite poorly with regular basic shapes (such as a rounded rectangle) that are supposed to be uniform and mathematically prefect.

It seems to me that, given the knowledge that an antialiased raster image was created from a vector, that some degree of deriving a mathematically accurate vector should be feasible. Obviously the original Bezier handle information, etc. is not recoverable, but close approximation (closer than most path tracing algorithms that show up on the first page of Google results) seems realistic. To my knowledge, an antialiased line should indicate the (approximate) subpixel location of a line that passes through a 2x2 pixel area, therefore it seems probable that some software might be able to use this assumption to extract some additional information to ensure the resulting vector passes through/near the approximated subpixel location. However, I don't know of such software should it exist.

Therefore, does such an algorithm/software designed to re-vectorized rasterized vector images exist?

  • I dont think this is within topic here. But no there is no specific algorithm for this just a demonstration of the poorness of current algorithms. Also note many vector engines are incapable of making circles perfect so dont know about perfectness.
    – joojaa
    Commented Jan 10, 2022 at 5:05
  • It's a matter of entropy. Commented Jan 10, 2022 at 10:09
  • @joojaa Sorry, wasn't sure if this should be a graphics or software/coding question as it involves both.
    – That Guy
    Commented Jan 11, 2022 at 4:20

3 Answers 3


Once the data is raster, it's raster. There's no remaining vector content. Nor any remaining trace of what any vector data may have been. You can't reverse-engineer the image to get any vector data.

It's a raster image. All software will see it as a raster image. Whether a well defined raster image with some slight anti-aliasing or not. It needs to be traced as a raster image.

Imagine you bake a cake.... you know what the basic ingredients were at the start... but there's no way to reverse engineer the cake to get the back eggs, flour, sugar, water, etc. in their original state. The cake has been baked.

  • I understand there's no vector content remaining. However, given that an antialiased line should indicate the (approximate) subpixel location of a line that passes through a 2x2 pixel area, it seemed probable that some software might be able to use this assumption to extract some additional information (to ensure the resulting vector passes through/near the approximated subpixel location?)
    – That Guy
    Commented Jan 11, 2022 at 4:19
  • 1
    I get that. It seems logical, but as far as I'm aware software merely sees a pixel. It's not aware of what that pixel may mean. I think you are asking software to make a determination based upon visuals, when software doesn't really have the visual. It merely sees pixels. Again, it seems possible, but I don't think such an AI exists and would most likely be very difficult to write considering it would take some intelligent decisions as to what's anti-aliasing and what isn't.
    – Scott
    Commented Jan 11, 2022 at 13:17

Perhaps centreline autotracing is what you are looking for, however it has its limitations. It can work reasonably well on simple shapes which are separate, but will mess up spectacularly with anything more complex such as overlapping shapes, or lines which cross over each other.

I think that would require some kind of AI subroutine (or human) to recognise specific shapes and separate them out before tracing commences, more than just an algorithm.

When you start talking about computers "knowing" things, that implies AI, some kind of pattern/shape recognition, probably using a database of example images to check against. Might be possible some day, or perhaps someone is working on something like that already. I've no idea, and this is merely speculation.

Anyway this is an example of Inkscape's centreline autotrace

enter image description here

Trace results for separate shapes are OK (or should I say OK at a distance), but nowhere near perfect on closer inspection. It seems to do curves better than corners. Also the larger the bitmap, the better the results seem to get, and so it's very much dependent on the quality of the original bitmap.

enter image description here

Overlapping shapes are almost a total failure, as the software knows nothing about the specific shapes. It's just an "idiot" machine.

enter image description here

  • That certainly seems like an improvement in certain situations, but I don't think it really answers the question as it's not designed explicitly for raster images that were previously vector.
    – That Guy
    Commented Jan 11, 2022 at 4:28
  • @ThatGuy - actually no, Inkscape's autotrace was designed to trace previously vectored graphics. That's precisely what it is for, even though it might not be quite what you are looking for.
    – Billy Kerr
    Commented Jan 11, 2022 at 8:56
  • Here's the thing though @ThatGuy how do you know anything was "previously vector"? I can show you some vector illustrations which may appear to be raster in nature.. so... Vector doesn't simply mean "hard simple lines" or even "defined edges". Raster images can have the same minimal, subtle, anti-aliasing as vector images, especially since many raster editors also have vector tools. The line between vector and raster is considerably more blurred than you are thinking.
    – Scott
    Commented Jan 12, 2022 at 1:28
  • @BillyKerr my understanding is that it was general-purpose (as in, would work equally well with a scanned inked line as it would with a line rendered digitally), is that not correct?
    – That Guy
    Commented Jan 12, 2022 at 5:15
  • 1
    You miss my point @ThatGuy ... how would any algorithm know something was "previously vector"? Tracing apps already have a 1 color/threshold option.
    – Scott
    Commented Jan 12, 2022 at 5:36

It's partially possible. There are available special tracing tools for engineering drawings and maps which take into the account that the original was of a certain image type. They do remarkably better vectorizing job than Illustrator or Inkscape, which fail where lines join or have crossings.

One low cost commercial example I have tried (and it worked): Vextractor https://www.vextrasoft.com. The next has so high price that I have not even bothered to ask a trial: http://www.easytrace.com (see NOTE1)

Then there are the general geographic information systems (=GIS, free and commercial ones) They are monsters which have also tools for converting raster images of maps to vectors. They may claim "automatic tracing", but that's not 100% true. The raster image needs some manual cleaning at least when everything is black on white. An example: https://www.youtube.com/watch?v=QMTUFfE2VXo

CAD users need the same. See this ad: https://www.youtube.com/watch?v=YEbmUrXOhFg Good results need some manual interventions, but the video is old.New versions probably are more intelligent (a guess).

The next one vectorizes CAD drawings https://www.raster2vector.com The price of the software is not public, one must ask a quotation and if one wants a trial he must look a potential purchaser. That's an effective way to keep away non-profitable punters and probably a good bunch of others, too.

Optical character recognization from images of texts can be considered as the ultimate version of the idea. It's available as a tool in Adobe Acrobat and Microsoft One Note. There are also free OCR programs. Search for "free OCR" Check also this compilation https://www.adamenfroy.com/best-ocr-software

But the success is based on assumption that the image content originally before rasterizing had sharp edges and somehow limited variety of shapes. The program tries to find which possible shape fits best. With an arbitary image content it is impossible - the program cannot know what part of the blurriness is actual image content and the idea of trying which fits best is impossible if there's no limitations for the forms.

NOTE1: Both of them come from Russia.

  • 1
    Interesting, but they just appear to be tracing no differently than AI or Inkscape or VectorMagic, et. al.... they are merely using the paths to create fills.. and then removing the tracing. I don't see any "shape recognition" anywhere. And actually, it looks far more convoluted than merely using AI, Inkscape, VectorMagic. But... well.. I don't have the software so perhaps the videos don't explain well enough. (DV wasn't me).
    – Scott
    Commented Jan 11, 2022 at 0:04
  • Many of them know that crossing lines are 2 separate lines, not 4 nor 1, they see rectangular shapes and place them , they keep dashed lines as one, place perfect circular arcs and all lines and curves are single strokes, not narrow stroke resembling filled areas. With ordinary tracing in drawing programs one gets just that crap that Mr. Billy Kerr showed or all strokes are expanded to filled areas.
    – user82991
    Commented Jan 11, 2022 at 18:09

Your Answer

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

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