Scribus fill image to frame

Although, there are scripts on that do this, they were not working for me with Scribus 1.4.2, no matter what I tried. This has led me to do two things: rewrite the script, and use it on Scribus 1.5 SVN, where it works. The interface on the newer version is smoother and faster, and thus far, I haven’t hit any bugs.

Here is the script, make sure you have nothing but image frames selected:

from scribus import *
import os

if haveDoc():
    objList = []

    for i in range(selectionCount()):

    for obj in objList:
        #setScaleImageToFrame(confined to frame = bool, proportional = bool, name)
        setScaleImageToFrame(True, False, obj)
        scaleX, scaleY = getImageScale(obj)
        setScaleImageToFrame(False, True, obj)
        if scaleX > scaleY:
            scale = scaleX
            setImageScale(scale, scale, obj)
        elif scaleY > scaleX:
            scale = scaleY
            setImageScale(scale, scale, obj)



Update: I tried to open my 40 – some graphics intensive pages of my portfolio layout in 1.5 svn, and it is so sluggish, that it was unusable yet. For the 3 pages of images I was doing the testing on, it seemed fine, but it doesn’t seem that it’s optimised enough for larger documents. Or perhaps, if i were to start initially in 1.5 as opposed to 1.4.2, it may have been different.

Scripting and Automation of repetative image tasks

For a task that required the conversion of a PDF for print to image files sequence for web display, I had to figure how to export them as quickly as possible, re-combine two facing files into a single “spread”, and add a graphic element that makes them appear more like books. It is a bit of pseudo code, since I am not very familiar with Terminal, besides entering single commands, and installing add-ons in python always seems a bit daunting.

Here is the process for Ubuntu 12.04:

  • Starting with a book.pdf, convert all PDF pages to images, using ghostscript. First, open Terminal, and type “cd”, drag and drop the directory where your PDF is located into terminal, and press enter. Then, type the following command:
    gs -dNOPAUSE -dBATCH -sDEVICE=pngalpha -r300  -sOutputFile='page-%00d.png' 'book.pdf'

    Now you should have a png for each page

  • To combine them into spreads, with Imagemagick installed:
    -montage -geometry +0+0 page-2.png page-3.png spread2-3.png

    However, if you have 160 pages, handwriting that would take a bit of time, so I made a python script that makes a text file with the above command for all pages

  • In gimp, I made a gradient line in the middle to make the images appear more like book pages. I started with one of the spread, created a new layer, in which I put the gradient exactly in the middle, and then erased everything except the gradient line, keeping the dimensions exactly the same.
  • To overlay the gradient line with each of the spreads without opening Gimp or Photoshop
    composite line.png spread2-3.png
  • I am not sure yet how to develop loops with terminal, so I made the following python script that creates a text files with commands that I then copy and paste into Terminal:
    # outputs a file to use for terminal, specifically for PDFs
    #create or open a text file
    f = open("file.txt", "w")
    outNames = []
    # output spreads
    # range of pages, start with 2, since spreads usually are even-odd page
    for i in range(2,10):
        if i%2==0:
            a = i
            b = i
            c = ("s%s-%s.png" % (a,b))
            text = ("montage -geometry +0+0 page-%s.png page-%s.png %s; " % (a,b,c))
    #overlay with gradient line
    for i in outNames:
        text2 = ("composite line.png %s s%s;" % (i,i))

    I pasted a quarter at a time, so as not to crash Terminal.

To do the same simple task without a little bit of code, would either mean Batch processing in Photoshop, or manually opening in Gimp or Photoshop, which doesn’t guarantee that on each page, they gradient line would be in the exactly the same place. However, I also know that this isn’t the most efficient way yet. If anyone has any suggestions, please share them.

Open Source Ecology

I have recently read this article from 2010 in the Guardian about how the U.S. views governments that use open source software as ones that promote piracy and constrict intellectual property. ( This, along with my recent observations that, if given the choice between a completely and legitimately free alternative that has no learning curve compared to the commercial alternative, most are much more likely and comfortable just to use the pirated original than spend 1% more effort in learning something new. (e.g. Autocad 2007 vs DraftSight). Beside the obvious legal issues of using pirated software, it is a major hinderance to the spread of open source software. Few are the ones that will venture out of their comfort zones to learn something new (and open source), but if the choice was always between a very expensive programme and a free alternative that takes a little more effort to learn, without any possibility to use pirated software, then it becomes very easy to make the choice with no funds available to learn something new. However, if those expensive programs are constantly pirated (as most small to medium architectural offices do), then there is no opportunity to pick up viable alternatives. Some of these ideas have been gathered from a discussion on archinect (

All of these topics fuel and inner flame to do everything possible to spread the closest we can get to true democracy anywhere on the world. Let’s form a network of design and non-design professionals to help promote open source as a substantially viable alternative, through professional experience to all pirated copies. Please contact me to discuss further.

Clean Quad Mesh Output from Rhino

Rhino is a great program but it typically suffers from creating poor meshes that cannot be easily edited later in polygon mesh modeling software, such as Blender, Maya, etc. With the help the Paneling Tools plugin (link), it becomes very easy to create quad meshes that can later be subdivided, easily.


It is possible to create a clean quad mesh with the mesh settings from rhino (mesh command), however it is difficult to get an evenly distributed quad mesh.With paneling tools in grasshopper, it is much easier.


This demonstrates how the mesh was done. First, we create a loft, and then apply a grid on the loft. Then, we create cells, which produce mesh faces. We flatten the cells into one mesh with the mesh join component, and then we weld vertices.


mesh01-1024x576The top is the mesh from Rhino in Blender, which is then subdivided, with 2 new loop cuts introduced, which were then scaled slightly down.

Grasshopper to Revit workflow

I have been busy lately converting a complex timber slatted ceiling from grasshopper into native Revit geometry. I have tried all the popular plugins that translate geometry between grasshopper and Revit. At the moment, I am using Grevit and lyrebird, to place point-based adaptive components with a conversion scale factor of mm to ft – 0.0032808399. I have also used the hummingbird plugin to place rotated families, however only half of them come into Revit properly rotated.

In all, I a very excited about using a familiar platform to drive Revit native geometry.

Open Source Worflow

Open Source / Alternative programs and their commercial equivalents

Rhino, 3ds Max, Maya – Blender
Vray –  Blender Cycles
Illustrator – Inkscape, Affinity Design ( $50, non open-source)
Photoshop – Gimp, Krita, Affinity Photo ($50, non open-source)
Indesign – Scribus, Affinity Publisher (coming up in 2017)
Autocad – Draftsight (free, non open-source), LibreCad
Microsoft Office – LibreOffice, Google Docs

About Open Source Software

If there is enough information reaching architects and architectual students about viable open source alternatives to 3ds Max, Maya, Rhino, Photoshop, Illustrator, and Autocad, then they will be much more likely to use them. Then, the installation of unecessary large and mostly pirated software will start to diminish. It is one of the few true forms of democracy, with access to everyone. And, similar to a democracy, the more people that take part, the better the software becomes, as more developers will become involved and the faster the software evolves. All of the programs mentioned below play well with their commercial equivalents in terms of information exchange. Thus, it is entirely possible to work in an open source environment and constantly exchange information with others that use commercial software.

Are they professional enough?

I use most of these software packages professionally on a regular basis at my job, where I constantly exchange information with colleagues and consultants between the open source programs and their commercial counterparts.

For you, willing to investigate open source software further, I would recommend to trust your intuition and experiment with it straight away. The more users, the faster the software evolves, the larger the user base, and more companies will have employees working with these new standards.

Further Details


Blender is the most successful open source program, and the one I am most knowledgeable about. As an expert in many other 3d suites, I prefer Blender for many reasons beyond the fact that it is open source. Once mastered, it is incredibly quick to turn ideas into reality. Bug tracking is ideal. I once reported a bug that was acknowledged and fixed in a day after posting it. Blender’s success lies in the Blender foundation, a non profit organization that employs a few full-time developers that lead the programming evolution on Blender. To push new features, Blender Foundation raises funds for movies through collaboration between artists and developers. Through this project based approach, new features become developed specifically for production and land into Blender much quicker than if they were to be executed without a tight deadline.

In addition to the tutorial on this page, below are few websites that can assist with information on starting with Blender. – a wide array of in-depth tutorials, including full beginner’s series – tutorials on all aspects of 3d, including architectural visualisation – forums for blender and galleries of images posted by users


Theatre seating layout with Grasshopper

Here is a script that calculates theatre seating layout. It allows for quick readjustments based on the perimeter, seat spacing, and rows. It is in 2d only, and it is very useful for testing different seating/perimeter configurations.


Link to Rhino file.



Portfolio Making with Scribus thus far

It has been a day and a half for making the latest version of my design and architecture portfolio, with which I am exclusively using Scribus, the open source alternative of Adobe InDesign. And it is so far so good. There are much less aspects that I need to get used to than what I initially thought. The most important differences are:

  • No drag and drop for images directly into your file. First you have to draw a frame, and then either double click on it, and right click and select “get image”.
  • Scripting. Directly related to the lack of drag and drop,there is a script that automatically arranges the images onto an A4, after which they are much easier to manipulate. The save the script by copying and pasting from this website as somewhere on your hard drive. And then go into scribus, under the script menu, choose “execute script”, and select the script you want to use. Then just, copy and paste the directory name into the net window.
  • Alignment. No smart guides (that I know of at the moment), to align easily, but the alignment and distribution tool is much more intuitive than the InDesgn one.
  • Images and PDF previews. The quality of previewing what’s contained in the image frames within the document is much better than the default one in InDesign. I know it is possible to change this behaviour in InDesign, but with my experience, it has slowed the program down to a crawl.
  • Master Pages. Have not had a chance to see how well a specific image layout works, but in terms of numbering the pages, it works the same way as InDesign. One difference is that in Scribus, there are separate master pages between left and right hand pages.

Update (10 May, 2013)

The align and distribute feature is quite powerful. It is the main tool that i am using. I also set the speific width and height of each image frame i work with.

I am continuing to work with scripts to ease up the workflow, but I have not been able to find good resource on Scribus scripting API reference. But I did find out that within the Scribus scripting console (Script -> Show Console), it is possible to type “help(command)”, e.g. “help(newDocument)” where all arguments are listed.

Listing all possible commands. Again, due to the lack of documentation within scribus, here is the way to see all commands by typing the following into the Scribus script console:


or conveniently listing them as opposed on one line

for i in dir(scribus):

then you can pick any command and do



Update 2 (11 May, 2013): Fiddling between Scribus 1.5SVN and 1.4.2

I tried to do some work in the more aesthetically pleasing Scribus 1.5 SVN, and it worked well, until I tried to open the 40-some page porftolio that I have been working on. At the moment, it is so sluggish at selecting images and moving around in 1.5, that it was impossible.  However, in a separate document, I worked  a bit in 1.5, and I needed to get it back in 1.4.2. So, I opened the scribus file in my text editor, and just changed the second line to from “1.5.0” to “1.4.2”, after which it was possible to open it. Although the frames are there in the outliner, they were not showing up, so I selected them all and copied and pasted them into a new document and now they are accessible