[scribus] frametoImage option

Gregory Pittman gregp_ky at yahoo.com
Wed Apr 7 14:52:09 CEST 2010

On 04/07/2010 08:21 AM, a.l.e wrote:
> hi greg,
> hi srikrishnan,
>>> In Scribus, there is an option in the porperties menu for adjusting
>>> both frame to image and image to frame options. But in Scribus API I
>>> have found only "setScaleImageToFrame", but I am not able to find the
>>> other one. Is it other option also available?
>> Yes, there is this option, but it's not in Properties.
>> If you right-click on the frame to get the context menu, you will see
>> you can both adjust image to frame and adjust frame to image. As you
>> suggest, many times you want to do one, and then the other.
> i guess it was about the scripter API...
> srikrishnan, one the one side, you probably don't really want a
> setScaleFrameToImage function, since you won't know how big the frame
> afterwards is... this is ok in a interactive workflow, but i'm not sure
> it's a good idea in a script...
> on the other side, i guess that you should be able to find all the
> information you need in the item properties.
> finally, if you still think that this function is needed, you may write
> a feature request
> http://bugs.scribus.net/
> i'm not sure it will be implemented in the near future... but who knows?
> (imho, it should be trivial to implement, but it's still some work to do
> and the developer ressources are currently limited...)

Oops! you're right, a.l.e

There are some times when you might want to do this in a script, one of 
which was when I augmented the InfoBox.py script, which sizes a frame 
according to the width of one or more columns of a text frame, and then 
allows importing an image.

I managed it by using the PIL (python imaging library) to get the size 
of the image, then adjusting the frame to the image for the desired 
width, and of course scaled the image to the frame.

Unfortunately, this PIL method stopped working some time ago, for 
reasons I haven't figured out. Here is the nonworking version:


it's the enhanced version at the bottom.

For the Scribus distros I had to eliminate the PIL use since it was 
freezing up Scribus in 1.3.3.x and 1.3.6 versions (must be some change 
in PIL). So you might try the InfoBox.py that comes with your version 
just to see how it works -- after it finishes loading and placing an 
image, you need to manually adjust frame to image, which is quite easy 
of course with the context menu.


More information about the scribus mailing list