[scribus] Changing page size from a script

Gregory Pittman gpittman at iglou.com
Mon Jul 23 21:03:11 UTC 2012

On 07/23/2012 04:32 PM, Adam wrote:
> Hello,
> I'm using a script to automatically lay out a file of scanned images,
> one image per page. Ideally, I'd like to be able to change the page size
> to match the image dimensions. I haven't seen a way to do this from a
> script. Does anyone know if this is possible?
> A related question: where are the Scribus python functions/methods that
> are available from scripts defined? Is there some way to define new
> functions?

First part:

If you have an svn version of Scribus, you can look at InfoBox.py for
the commands for the PIL (Python Imaging Library)

# at the beginning, here is where I try to import the library

pil_found = 1

    from PIL import Image
except ImportError:
    pil_found = 0

# later, here is how to make use of it (imageload is the variable for
the image filename):

            if (pil_found == 1):
                im = Image.open(imageload)
                xsize, ysize = im.size

so you can then use the dimensions to decide on your document page size.

Second part:

If you have Scribus source, it's in scribus/plugins/scriptplugin. I
wouldn't spend time making modifications in the current Scripter, since
a new version is coming with a very different method for creating new
Scripter commands.


More information about the scribus mailing list