[scribus] Scribus 126.96.36.199: Adjust Frame to Image script
ale.comp_06 at xox.ch
Fri Sep 18 09:19:17 CEST 2009
> you can review this script, which was made to insert a frame in a
> column of text, the exact width of the column. There was a kludgy sort
> of way that compensated for the lack of Adjust Frame to image, but
> what I eventually did is what you see below in this code fragment. The
> basic idea is to start with a certain width of the frame, then use the
> PIL (Python imaging library) to assess the size of the image and
> calculate an appropriate size for the frame.
> if (frametype == 'imageL'):
> imageload = scribus.fileDialog('Load image','Images(*.jpg
> *.png *.tif *.JPG *.PNG *.jpeg *.JPEG *.TIF)',haspreview=1)
> im = Image.open(imageload)
> xsize, ysize = im.size
> new_height = float(ysize)/float(xsize)*new_width
> new_image = scribus.createImage(new_left, float(new_top),
> new_width, float(new_height),framename)
> scribus.loadImage(imageload, new_image)
i guess it's time to go through the scripts in the wiki and create a
new systematic where you can get full scripts and find snippets which
make your life eaysier!
i will see if i come up with a good idea...
More information about the scribus