I work with line art SVG images; primarily converting them to other formats for use in my companies product (we can't yet support SVG well). Some of the SVG images I receive are from scanned sources, then run through a ray-tracer. They are then typically edited - as SVG - in Illustrator. The SVG files are just grouped path elements, with some text elemetns too (added in Illistrator).
I'm being asked to write this post, to see if there was some clever way to programatically determine if an SVG was authored as SVG, versus a ray-traced raster. I do not think it possible, but, need confirmation.
Thanks.
Detect SVG from scanned source
Re: Detect SVG from scanned source
Welcome to InkscapeForum!
Do you mean determine whether any random path was drawn originally as SVG, or originally drawn in a raster format, then converted to a path? I don't think so. Perhaps tracing a raster image adds something unique to the XML file, I'm not sure. But I'll test.... Ok, well it turns out that I don't know enough about XML. It doesn't look like anything special is added to paths from a traced image. But I don't understand XML very well.
When you say "ray tracer" I'm guessing that's something like Inkscape's Trace Bitmap (made with Potrace)? In some cases, you can tell by looking at how the image is constructed. For example, if you trace a line or line drawings, the result is not single stroked paths. Instead, it's closed paths, with a fill, and no stroke. So by selecting the path, and looking at the nodes, and fill/stroke indicators, you can see whether it's made of stroked paths or closed filled paths with no stroke. So if you know that the original image was a line drawing, and you see filled, closed paths, you can assume it was traced. However, it theoretically would be possible to draw that same image as you see it after the trace, originally as SVG. Although it really wouldn't be very feasible.
On the other hand, if you trace a filled rectangle or circle, or any shape, the result will also be a filled shape. In that case, there's no way to know, that I know of, to tell the difference.
OH! But then some trace engines have a centerline trace option. If you're using a centerline trace, on line drawings, I don't think there's any way to know whether it was drawn or traced.
Basics - Help menu > Tutorials
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Manual - Inkscape: Guide to a Vector Drawing Program
Inkscape Community - Inkscape FAQ - Gallery
Inkscape for Cutting Design
Re: Detect SVG from scanned source
You've pretty well described the though process I went through before I posted. Whereas potrace was not used in this case, yes, that's the type of thing I was refering to.
Thanks.
Thanks.