Scribusoid

Author Topic: How to easily add image frame to 100+ pages  (Read 375 times)

kylar.merrell

  • Newbie
  • *
  • Posts: 2
  • Karma: 0
  • Scribus User
How to easily add image frame to 100+ pages
« on: June 12, 2021, 04:28:14 am »
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

  • Hero Member
  • *****
  • Posts: 1450
  • Karma: 19
Re: How to easily add image frame to 100+ pages
« Reply #1 on: June 12, 2021, 10:34:41 am »
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

  • Newbie
  • *
  • Posts: 33
  • Karma: 0
  • Scribus User
Re: How to easily add image frame to 100+ pages
« Reply #2 on: June 12, 2021, 02:18:43 pm »
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):
Code: [Select]
# 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
« Last Edit: June 12, 2021, 02:22:47 pm by RobSay »

utnik

  • Hero Member
  • *****
  • Posts: 1586
  • Karma: 17
Re: How to easily add image frame to 100+ pages
« Reply #3 on: June 13, 2021, 12:34:07 am »
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

  • Jr. Member
  • **
  • Posts: 70
  • Karma: 1
  • Scribus User
Re: How to easily add image frame to 100+ pages
« Reply #4 on: August 10, 2021, 05:22:43 am »
What version does the "by page" option available?

utnik

  • Hero Member
  • *****
  • Posts: 1586
  • Karma: 17
Re: How to easily add image frame to 100+ pages
« Reply #5 on: August 10, 2021, 10:31:14 am »
hi admfubar

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

 

palmate