[scribus] Automatic creation of product catalgue

Gregory Pittman gpittman at iglou.com
Thu Mar 26 13:30:19 CET 2009

Stefano Danzi wrote:
> I need to automatically create e product catalgoue.
> I've a folder with fotos having mixed resolution (same 1700 dpi, other 
> 1200 dpi ecc ecc). Each photo, if printed at the correct resolution, 
> show an object at scale of 1:1 (real dimension, dimension of my items 
> goes from 1cm to 10 cm).
> I need to print a catalog that show all items with his real dimension, 
> and numbers of items for row depends on dimensions of object.
> There is a script that do something similar?
> I found scriptalbuma4.py but have a fixed layout (2 items on each row, 
> and I need multiple items for row depending on dimensions) and don't 
> preserve reals image dimensions.

Stefano Danzi wrote:
> /How I can call "Adjust Frame to Image/" function from a script? Under 
> scripting references there are nothing about this.
If you check the InfoBox.py script, you will see some things that will 
help. There is no Adjust Frame to Image in Scripter.
Use the PIL like this:

        from PIL import Image
    except ImportError:
        print "Unable to import the Python Imaging Library module."

then if you go farther down in InfoBox.py you will find:

        imageload = scribus.fileDialog('Load image','Images(*.jpg *.png 
*.tif *.JPG *.PNG *.jpeg *.JPEG *.TIF)',haspreview=1)
            im = Image.open(imageload)
            xsize, ysize = im.size
        new_height = float(ysize)/float(xsize)*new_width # this adjust 
height according to the column width
        new_image = scribus.createImage(new_left, float(new_top), 
new_width, float(new_height),framename)
        scribus.loadImage(imageload, new_image)

where you see to use Image.open, then .size to get the dimensions of 
your image. In the case of InfoBox.py, the frame dimensions are limited 
to a fixed width based on the column that the image is placed in.

So you should be able to use these methods to accomplish your task. If 
your desire is for a full-size frame according to image size, then 
adjusting scale should be unnecessary.


More information about the scribus mailing list