Re: batch load svg files into scribus
Gregory Pittman <gpittman-s/[email protected]>
| Newsgroups | gmane.comp.graphics.scribus |
|---|---|
| Message-ID | <[email protected]> |
On 8/3/20 2:47 AM, Meaux Mazey wrote: > I'm new to email list servers. I'm not seeing my post on the archive. Do I > need to resend? > > > On Sat, Jul 25, 2020 at 5:59 PM Meaux Mazey <[email protected]> wrote: > >> Hello world, >> I was looking for a script to batch load svg files into a scribus document. >> I found a thread from 2015 that gave the function placeSVG (filename, x,y) >> one function is not a script. >> Is there a batch script written? >> Hi Meaux, I don't know what happened, but the message never showed up on the 25th. As far as your question, I think that importing SVGs has a lot of considerations that are hard to generalize, since the placeSVG() command just places the SVG without regard to its size. Here is a very small script that just places a chosen SVG at 100, 100 (I use points units). ******** #!/usr/bin/env python # File: impsvg.py # Imports SVG to document to current page import scribus import os mySVG = scribus.fileDialog('Select an SVG','SVG files (*.svg)') scribus.placeSVG(mySVG,100,100) ******** If you had a number of SVGs in a directory you could put in a command to select a directory, like svgdir = scribus.fileDialog('Select SVG Directory','Directories',isdir=True) d = os.listdir(svgdir) D = [] for file in d: if file.endswith('.svg') or file.endswith('.SVG'): D.append(file) After this, you would have to have some scheme of where the SVGs would be placed, and go through your list D to place them. This is something like the script I wrote from creating an album of images, though there I had a much wider range to image types to consider, but this used a fixed layout: https://wiki.scribus.net/canvas/Automatic_import_of_images:_Versions_not_requiring_Tkinter Hopefully that's enough to get you started. Greg ___ Scribus Mailing List: [email protected] Edit your options or unsubscribe: http://lists.scribus.net/mailman/listinfo/scribus See also: http://wiki.scribus.net http://forums.scribus.net