[scribus] another photobook script
Gregory Pittman
gpittman at iglou.com
Mon Feb 8 14:01:11 UTC 2021
On 2/7/21 6:36 PM, adam armfield wrote:
> hello,
> i'm writing a hopefully simple script that I can point at a folder of jpegs, and have it make a page per pic with an image frame on it, with one of the jpegs in.
> this is what I've got so far:
>
> ------------------------------
>
>
>
>
> import os
>
> import glob
>
>
>
>
>
>
> os.chdir('/imagefolder')
> os.scandir('/imagefolder')
>
>
>
>
>
> pics = glob.glob('*.jpg')
>
> for p in pics:
> newPage(1)
> createImage(0, 0, 90,90,["pic{picname}".format(picname = p)])
>
>
>
>
>
>
>
> -----------------
> at the moment it doesn't seem to work as I was expecting in scribus, I adapted it for general python, the string formatting does what i'd expected (appends "pic" onto the filename, I was planning to name the imageframes like this):
>
>
>
> -----------
> import os
> import glob
>
>
> os.chdir(' /imagefolder')
> os.scandir('/imagefolder')
>
> pics = glob.glob('*.jpg')
>
> for p in pics:
> print(p)
> print("pic{picname}".format(picname = p))---------------------
>
> the bit where I create new pages also only works under certain circumstances
>
>
> for p in pics:
> newPage(1)
> sometimes it makes 19 new pages, other times it makes 1, other times it doesn't make any, it doesn't work at all when I use my createImage line, but I did manage to create one image frame when I gave it a hardcoded name
>
>
> createImage(0, 0, 90,90,["pic{picname}".format(picname = p)])
>
>
>
>
>
>
>
>
> any ideas? I was planning to follow this with a loadImage
>
> this is in 1.5.6.1
>
Hi,
I presume you're just showing us some fragments of your script.
Why not start with some scripts that work?
https://wiki.scribus.net/canvas/Automatic_import_of_images:_Versions_not_requiring_Tkinter
These are designed to make a document with multiple pictures per page, but could be modified for only one.
Greg
More information about the scribus
mailing list