[Scribus] On the way to scribalbum.py
Gregory Pittman
gpittman
Tue Feb 1 03:51:26 CET 2005
Wolfgang Pagel wrote:
> Gregory Pittman wrote:
>
>> Something which could be a work around while I wait for a scripting
>> command for Scale to frame size, would be an expedited way of doing
>> this manually. ...
>> ...
>> Greg
>
>
>
> Hi, Greg, I use the following workaround:
> 1) Install the Python-GD-package and add
>
> import gd
> from gd import *
>
> at the beginning of the script.
>
> 2) Write a piece of code like this.
>
> ----- snip ----------------------------------------------
>
> im = gd.image("bild.jpg", "jpeg")
> abmessungen = im.size()
> bildbreite = abmessungen[0]
> bildhoehe = abmessungen[1]
> faktor_x = float(ImageWidth)/float(bildbreite)
> faktor_y = float(ImageHeight)/float(bildhoehe)
> faktor = max(faktor_x, faktor_y)
> bildbreite_neu = faktor * bildbreite
> bildhoehe_neu = faktor*bildhoehe
> LoadImage("bild.jpg", ob)
> ScaleImage(faktor, faktor, ob)
>
> ----- snap ----------------------------------------------
>
> Excuse my german named variables - the meaning should be clear however.
> Change the calculation of the factor "faktor" for Your own if
> necessary (maybe "min" instead of "max" which makes sense in some
> cases ...)
>
This is good to know, I may need this; I'll find the English translation
of the docs.
> But beware, You will not see the scaled image in the actual Scribus
> job. I don't know why. Maybe a bug?
> Close the document an reopen it. You will see the scaled image.
I already noted this and mentioned it on the list.
Greg
More information about the scribus
mailing list