I have a folder of about 200 svg files. I'd like to use Inkscape to distribute them on a single svg file, but I'd like to put, under each image, its filename (possibly without extension). Now, because I have a lot of svgs, I'd like to do this automatically. Is this possible with Inkscape (or GIMP)?

Thanks in advance.

  • Is each file of the same size? You may put a text in each file with a script from the OS. The problem is, where to place the XML-code, probably at the very end. But if black text is placed above black background, it will be hard to find. If the colors of the images are similar, for example each image is mostly white background, and each of same size, it might be a good idea to work with semi-automation, place the reasonable sized filename at the bottom left, and move it to the final position by hand. Would be easy to do and save a lot of work, but not all of it. – user unknown Mar 15 at 14:24
  • Adjusting the text size for each image individually would be more complicated. Choosing an appropriate text color, if it is above the image, even more. Which OS are you using? Does it come with sed? Gnu-sed is available for most platforms (Linux, Mac, Win), on Linux it is usually preinstalled. – user unknown Mar 15 at 14:26
  • Well, I'm trying to design a solution by manupulating pure svg and I'm getting results. I have sed installed on my GNU/Linux Debian. Anyway, I do not want the filename overlap the image. – LuxGiammi Mar 15 at 14:38
  • That's what I currently found out by experimenting a bit: there is a text element in SVG to create some text. That element has a style property where you can specify a text-anchor. Setting it to middle easily allows me to put the text at the center of the image. Then, setting the y property, knowing the font size, allows me to put the text below the image, although I get some strange results (I specified a font-size in pixels inside the svg file, but I get an actual different font size in Inkscape). Now the last problem is to identify the correct font size, but I'm working on it. – LuxGiammi Mar 15 at 14:41
  • This tutorials.jenkov.com/svg/text-element.html might be a useful source for you. Often, the SVG described there is more dense than what Inkscape produces, but inkscape can read/interpret it flawlessly, according to my experiences. – user unknown Mar 15 at 15:02

If the images can be converted easily to a bitmap, and you use the import - link option rather than import - embed, the XML code will contain the full path.

This would mean a substantial bit of manual labor to effectively duplicate the svg images, extract and place the filenames, truncated to remove the path and then remove all the bitmaps and replace them with the SVG files, unless the bitmaps alone would suffice.

Someone with suitable scripting skills may be able to create an extraction script to work within Inkscape extensions.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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