From Scribus Wiki
Revision as of 14:56, 4 November 2016 by Gpittman (talk | contribs) (Automatic import of images: Versions not requiring Tkinter)
Jump to: navigation, search
This article is part of the Scripts series.

I decided to beef up this page a bit, since we get a number of questions about whether a script can be written for some task or other, and one quickly realizes that it takes some time to find all the scripts that deal with such a task. What people really need is a quick survey of what's out there, so that they can either modify some existing script themselves, or be able to ask for help with the modification for their particular needs.

I'll try to start with simple scripts first, then go to more complicated or perhaps esoteric ones down the page.

Import an image in the way office-programs do

This script does the simple task of taking an image file and making a standard image frame and loading it onto a page. In a modified state, it is one of the scripts included with Scribus,

The presumption is that you will then resize and reposition this image in most cases. One downside in the modified script is its need for PIL, the Python Imaging Library. The advantage of PIL is that you end up with a frame exactly dimensioned for the image, and importantly the frame ends in a state of scaled to frame proportionally, so resizing keeps the proportions.


Image Wizard: Scale and Align an Image

With this idea that you have imported an image, but want to adjust various details about it, we come to Image Wizard. I confess I haven't tried this one to make sure it still works, but what it does is use tkinter to create a remote control-like structure for a number of manipulations as shown. While I can understand that for a Scribus novice this might seem a great tool, realistically most of these manipulations are easily done without a script. For example, right-clicking on an image frame brings up a context menu to adjust frame to image or image to frame. Flipping horizontally and vertically are one-click operations in the X,Y,Z tab.


You might also have a look at Align an Image in its Frame . This does the simple task of aligning an image in the frame, such as upper left corner or centering, again using tkinter, though here you can select multiple image frames at once before running the script.

Likewise, there is Scale an Image to Fill a Frame Proportionally. Just as with Image Wizard, this scaling of images is now done so easily on the main screen there is probably little need for this.

Automatic import of images: Versions not requiring Tkinter

In addition to this particular wiki page, you might also look at Automatic import of images from a directory using a script and Making a photobook from a directory of images using a script. All of these in their own way is operating from the point of view that you have a directory of images that you wish to incorporate into a Scribus document. It's one thing if you have half a dozen images, but what about a directory of 60 or 100? That's a lot of image frame creation!

I started out thinking that tkinter was a desirable way to go, but I find tkinter rather ugly and hard to read, so I decided on finding a way to get around it. This results in a series of value dialogs to accomplish the same thing, though certainly more easy to understand and modify. For my personal use, I felt that either 4 or 6 images on a page served my purpose. Fewer images on a page allows for more annotations and commentary. There is almost always some need for post-script editing, but these scripts get the heavy-lifting out of the way.