[scribus] another photobook script

adam armfield adamairmailed at yahoo.com
Mon Feb 8 15:40:30 UTC 2021


thanks, that was the whole script (so far), is this example you've shown me for python 2 or 3?

All the best Adam 

    On Monday, 8 February 2021, 14:02:20 GMT, Gregory Pittman <gpittman at iglou.com> wrote:  
 
 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


___
Scribus Mailing List: scribus at lists.scribus.net
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
http://wiki.scribus.net
http://forums.scribus.net
  
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.scribus.net/pipermail/scribus/attachments/20210208/d3247218/attachment.htm>


More information about the scribus mailing list