Automatic import of images from a directory using a script

From Scribus Wiki
Revision as of 16:40, 28 January 2006 by Gpittman (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

The reasons I made these scripts was, first of all, to learn some Python, but also to be able to create a picture file or album in Scribus. What I generally use this for is to organize the digital pictures I may take from some trip. One advantage of Scribus is that its native .sla files do not include image data, but only references to them, so this cataloguing file is relatively small. For some collections I will add annotations, make a PDF, and then print out an actual album.

Initially, I had created a stand-alone Perl program (scribalbum.pl) to do this outside of Scribus. It still works even though I made it according to the 1.2.x series of file formats. One advantage it has is that it is quite fast and will generate a many-paged document in a few seconds. Its disadvantage is that it rather clumsily just does a rote spitting out of a particular format, and there is a danger that it may not work with some future versions of Scribus. "Fixing" it to generate a 1.3.x format is more work than I would like. Best to load into 1.3.x Scribus then save from there.

The Python implementations have the advantage of using Scribus itself to make the document, so as long as the script works, the resulting file will be up-to-date. Another advantage is more easy modifications to fit other needs.

I will add a link to the files once I learn how to upload files to the Wiki.


scribalbum.pl

I'm not going to say anything about this program. If you know something about Perl, you will see that it's not elegant, but it gets the job done. It operates on the command line.

scribalbum.py and scribalbuma4.py

These are similar Python scripts, the first of which makes US Letter pages and the second A4 pages. Both create a new document and as many pages as needed. scribalbum.py places 4 staggered images on a page, allowing for annotations in the remaining white space. scribalbuma4.py places 8 images per page with little remaining white space. Both versions will make a text frame in the upper left corner of each page indicating the directory the images came from, and each image has a label showing the image's filename.