How to easily add image frame to 100+ pages

Previous topic - Next topic

kylar.merrell

I need an image frame added to 106 pages. Each frame will contain a different image. How can I do this without having to manually add an image frame in the exact same spot on each page.

Nermander

I would create the frame and place it correctly on one page, then send to scrapbook.

Then for each page where the frames is to be added, a double click in in the scrapbook is the only extra action needed in addition to the Get image you would still have to do (since each frame will have a different image).

If the frames were already added, you would still have to select every frame (single click) and do Get image.

But I have to confess I am not sure wheter a frame inserted from the Scrapbook autimatically becomes selected.

RobSay

#2
Hello - this is a classic problem for which scripter is the solution.

If you think about the repeated actions *as a user* - they go something like this:

  • On the current page create an image frame at *some position* with *some size*
  • load an image into this frame
  • resize the frame and/or image
  • create the next page and go to there ready to start again

If you create a new scribus document with one page - then select Script Menu > Show Console and run this (with your image file name):

# create the image frame .. parameters are x,y,width,height - using the units of your document (mine are mm)
someImageFrame = createImage(10, 10, 100, 100)
# load the image into the frame just created - note the forward slashes for windows (file type can be anything you can do manually)
loadImage('D:/Some/path/to/my/images/processed001.eps', someImageFrame)
# scale the image to the frame size (there are ways to scale the frame to the image
setScaleImageToFrame(scaletoframe=1, proportional=1, name=someImageFrame)
# add a new page (uses default master page if not named)
newPage(currentPage()+1)

That automates all of the user actions listed above. All of the scripter functions are here: https://impagina.org/scribus-scripter-api/ Have a look at the definitions of the commands I used in the script - and you should be able to see how they work. For example - click on 'Images' in the left hand menu and the first function listed is 'createImage'

You *could* just create a massive script (in notepad) with that block repeated 106 times - with a different file name each time and paste it into the console - this would work but only really as a one off. What I do is I have a list of the image file names and I get the script to open that list and loop through each file and insert each one - again you can do this directly in the console... but that soon gets hard to manage. If you want to do this more often and potentially add more layout / frames / styling etc you will want to save the script (as 'something.py') and execute the script as needed.

cheers

Rob

utnik

hi kylar.merrell

if you need this image frame on all the pages in a range (or all odd or even pages), you may create it on the first page of this range, select it and use 'item' → 'duplicate/transform' → 'multiple duplicate' → 'by page' and select your options...

utnik

AdmFubar

What version does the "by page" option available?
Using Scribus 1.6.1, openSUSE 15.6
Advanced hobbyist

utnik

hi admfubar

Quote from: AdmFubar on August 10, 2021, 04:22:43 AM
What version does the "by page" option available?

i don't know.
the oldest scribus version i have on my system is 1.5.6.1 and there the 'by page' option can be selected. but it might not be possible with scribus 1.4...

utnik

WV-Mike

#6
Quote from: utnik on August 10, 2021, 09:31:14 AM
hi admfubar

Quote from: AdmFubar on August 10, 2021, 04:22:43 AM
What version does the "by page" option available?

i don't know.
the oldest scribus version i have on my system is 1.5.6.1 and there the 'by page' option can be selected. but it might not be possible with scribus 1.4...

utnik

I am using Scribus 4.8.7 and I do not see the "by page" option.
I wish to make multiple duplicates of  two images and a text frame.
When I use "duplicate multiple" I am not getting the proper spacing between the duplicates.
I have tries various gap sizes and I can't seem to get it right.
There are some screen shots here:
https://photos.app.goo.gl/GnSDMH3Z8JV8bVW3A

Thanks,
WV-Mike

utnik

hi mike

Quote from: WV-Mike on February 21, 2022, 04:22:23 PMI am using Scribus 4.8.7...

what???

Quote...I do not see the "by page" option.
I wish to make multiple duplicates of  two images and a text frame.
When I use "duplicate multiple" I am not getting the proper spacing between the duplicates.
I have tries various gap sizes and I can't seem to get it right.

did you ever try 'by rows & columns'? (the other tab of the 'multiple duplicate' window...)

utnik

WV-Mike

Quote from: utnik on February 22, 2022, 03:58:00 PM
hi mike

Quote from: WV-Mike on February 21, 2022, 04:22:23 PMI am using Scribus 4.8.7...

what???
Ooops! - 1.4.8

Quote...I do not see the "by page" option.
I wish to make multiple duplicates of  two images and a text frame.
When I use "duplicate multiple" I am not getting the proper spacing between the duplicates.
I have tries various gap sizes and I can't seem to get it right.

did you ever try 'by rows & columns'? (the other tab of the 'multiple duplicate' window...)

utnik
[/quote]

I have been trying that but no matter what gap size I use the added items do not fit the quides.

Since I only have 26 "panels" I am just going top place everything manually.

Thanks,
WV-Mike