Re: another photobook script

Gregory Pittman <gpittman-s/[email protected]>
Newsgroups gmane.comp.graphics.scribus
Message-ID <[email protected]>
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: [email protected]
Edit your options or unsubscribe:
http://lists.scribus.net/mailman/listinfo/scribus
See also:
http://wiki.scribus.net
http://forums.scribus.net
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.