[Scribus] On the way to scribalbum.py
Wolfgang Pagel
wolfgang.pagel
Mon Jan 31 12:19:07 CET 2005
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 ...)
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.
Wolfgang
--
Dr. Wolfgang Pagel / WPsoft
Berliner Str. 58, D-16556 Borgsdorf
Fon: (+49) 33 03 - 40 31 01, Fax: (+49) 33 03 - 59 00 81
Mobile: (+49) 172 - 96 73 116
eMail: wolfgang.pagel at wpsoft.de
More information about the scribus
mailing list