1

Context

I am working on a personal project that necessitate the use of an intermediate software that produces a pdf. After pdf generation, I save as an svg file using Inkscape (with internal import), and I further work on the document.

I know for a fact that the document embed a raster image (that shows a "shape"), and also that it features several paths that describe the contours of said shape (thanks to @BillyKer for pointing me in the right direction).

An example of output by that software: enter image description here

and the corresponding file.

The number of paths is exactly four times the number of vertical "picks" you see (one path for each quarter of a pick).

Question(s)

  1. How can I use the paths to remove the background (clip and / or mask the raster image) ? In a fashion that allows me to use the paths nodes to clip for precise scaling of the (raster) image.
  2. It seems to me (but I'm not very xml-svg-savvy) that there is a lot of useless "mess" in the xml; is there indeed a few clips / masks that are as useless that I suspect, and that I can just remove ?
5
  • 1
    Hi. Your link doesn't seem to be working. Says "Error, this is a private paste or is pending moderation. If this paste belongs to you, please login to Pastebin to view it."
    – Billy Kerr
    Commented Mar 1, 2022 at 13:35
  • My bad. Because of the content of it (an svg file), pastebin auto-moderation thinks it's a spam, so it's pending moderation. It should be accessible at some point, but I don't know how to share it in the meantime :( Commented Mar 1, 2022 at 13:48
  • 1
    Do you have a cloud file sharing service, microsoft onedrive, or apple icloud? Or perhaps try SVGshare.com - no account is required.
    – Billy Kerr
    Commented Mar 1, 2022 at 13:49
  • svgshare.com seems to do the trick, thank you very much :) Commented Mar 1, 2022 at 14:07
  • You could get the file size down a bit. If you trace the image with the standard bit map trace settings in Inkscape, delete the raster image, and save using "Optimised SVG", you could get it down from 1.11mb to about 15kb. see example
    – Billy Kerr
    Commented Mar 1, 2022 at 14:39

1 Answer 1

1

I can't access your file, so I can't be 100% sure.

Anyway, from your screenshot, it would appear to be a raster image because I can clearly see the jagged edges of pixels.

Inskcape can't really edit raster images, it's a vector image editor. There's are ways to use/alter raster images, but it's extremely limited. You could however autotrace it (using Path > Trace Bitmap), to turn it into a vector path in Inkscape. If it's a raster image you could also edit it in a raster image editor like GIMP, and simply select the white pixels and delete them.

Note that SVGs (and PDFs) can contain raster images as well as vector graphics, so the format alone can't really tell you much about what is contained within it.

Sometimes in Inkscape, depending on the construction of a file, it may be difficult to determine exactly what kind of graphic it is. This can be obscured if a graphic is contained in a clipping mask, or if it's a clone, or even just inside a group.

Rather than mess around in Inkscape, you could examine the SVG code by opening it in a text editor. If there is a raster image or a vector path in there, it will be obvious.

A raster image looks like this: an <image tag containing perhaps hundreds of lines of data.

 <image x="31.64" y="135.1" width="473.6" height="237.3" preserveAspectRatio="none" xlink:href="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAABv4AAAOBCAYAAAA5v9ebAAAABHNCSVQICAgIfAhkiAAAIABJREFU eJzs3VGSo7oVBmDjIjvQQ1ZwV5H9byBvWYOSDaSqycNkanoGudu2EEhH3/eUIn/NxSAdhA+4l23b ttsfcs5/brrdbrdbSqm4vTb/119/3f71r381+/fl5eXl5eXl5eXl5eXl5eXl5eXl5eXl5eXlx8v/ . . . .

A vector path looks like this: a <path tag, generally with much less data

<path d="m-78.53 115.7 26.42-84.25-10.35 98.17 35.7-97.45-20.7 111.4 41.77-112.8-32.48 124.6 51.76-128.9-0.7139 86.03 23.56-91.03-26.77 217.4 1.071-112.4-52.12 120.7 19.99-98.52s-55.69 96.03-55.69 93.53 27.13-84.6 27.13-84.6l-51.4 69.61s37.84-88.17 36.41-86.74c-1.428 1.428-34.98 54.26-34.98 54.26z" fill="#fff" stroke="#000" stroke-linecap="round" stroke-width=".4"/>
2
  • 1
    Excellent! You're absolutely right, the image was only raster. But now, with what you said, I have managed to output a file with paths that describe the contours (on top of the rest). I'll update my question accordingly. Also, I apologize for the file not being available yet, it's because pastebin is wary of my trying to spam (so the file is pending moderation). Commented Mar 1, 2022 at 13:55
  • @MacroController - no worries. Glad you figured it out.
    – Billy Kerr
    Commented Mar 1, 2022 at 13:59

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.