[scribus] Fit photograph to frame

Fang Liu fangyiliu at gmail.com
Fri Nov 27 08:23:31 UTC 2015

> On Nov 26, 2015, at 6:41 AM, Gregory Pittman <gpittman at iglou.com> wrote:
> On 11/26/2015 09:10 AM, Christian Mandel wrote:
>> Am 26.11.2015 um 13:43 schrieb Gregory Pittman:
>>> On 11/25/2015 10:27 AM, Christian Mandel wrote:
>>>> For me it would, (a) more functionality is almost always useful and (b)
>>>> more scripts mean more information to learn from :-)
>>>> Nevertheless, did you check my simpler scripting suggestion (my answer
>>>> to your other post)? Is this possible?
>>> I don't see any major advantage to your method; it's not more or less
>>> simple. I distort the frame, you would distort the scaling. But I will
>>> see if I can manage this.
>> I already try it and thereby try to learn a bit of python programming,
>> but I cannot get the scaleImage() function to do something useful. I
>> opened a new thread for this.
>> The benefit that I see is that rounding errors will not change your
>> frame but only the image. I fear that if it is done repeatedly there
>> errors could maybe sum up (in some very constructed, special, cases) if
>> the frame is changed repeatedly, the image, on the other hand, is always
>> set to defined starting conditions (frame completely filled) and
>> therefore you are rounding one time maximum. It is of course a rather
>> theoretical consideration with almost no practical impact, but that's
>> unfortunately the way I think about these things :-)
> There will be no rounding errors. As you can see in my notes after the
> script, there is no recalculation to return to the prior size. I save
> the original value and just reassign it.
> Meanwhile, I have reworked the script per your suggestion, and posted on
> the wiki:
> http://wiki.scribus.net/canvas/Fitting_an_Image_to_its_Frame#fitimage2frame_v2.py
> It may be that your mods didn't work because scaleImage() is deprecated,
> the new command is setScaleImage().
> Greg

I’m just looking to learn a little about scribus scripting.
This looks to be the same approach taken by this script from 2007. http://wiki.scribus.net/canvas/Scale_an_Image_to_Fill_a_Frame_Proportionally
It works if you replace scaleImage() with setImageScale().

Is it necessary to call docChanged()? I looked it up and It’s supposed to mark the document as changed so you the save menu item is enabled.


More information about the scribus mailing list