[scribus] Image to frame "spacing"

Gregory Pittman gpittman at iglou.com
Wed Jan 25 19:58:58 UTC 2017


>> You can do this by adjusting the scaling, but there are no measurements
>> to help you -- you just "eyeball it".
> 
> Hi, Greg,
> 
> Sorry for the late reply, other life activities took priority.  LOL
> 
> Scaling did what I was looking for, and I got things more or less
> centered.  <G>
> 
> It would be nice if, in a future version of Scrbus, the ability to
> automatically center the newly scaled image vertically and horizontally
> in the frame would be convenient.  Along with next to each edge of the
> frame.
> 
> 

Here is something that might help a bit. On the wiki there is a script
that will place guides at the borders of a frame or object:

https://wiki.scribus.net/canvas/Making_Guides_at_an_Object%27s_Borders

Here is a modification that will create borders inside the borders of a
frame, to create a space 80% of the original dimensions.
*******begin script*******
#!/usr/bin/env python
# -*- coding: utf-8 -*-

import scribus

if scribus.haveDoc():
    try:
        f = scribus.getSelectedObject()
        xpos, ypos = scribus.getPosition(f)
        width, height = scribus.getSize(f)
        scribus.setHGuides(scribus.getHGuides() + [ypos + 0.1*height,
ypos + height - 0.1*height])
        scribus.setVGuides(scribus.getVGuides() + [xpos + 0.1*width,
xpos + width - 0.1*width])
        scribus.setRedraw(1)
    except:
        result = scribus.messageBox('Error', 'You must select an object')
        sys.exit(1)

else:
    result = scribus.messageBox('Error','You need a Document open')
*******end script*******

In the math there, I am moving the guides from the edges inward, 10%.
Since I'm moving from each side, this is a total reduction of 20% of the
width and height. Change the decimals to your liking -- if you only
wanted a total reduction of 10%, then make each decimal 0.05, for
example. It would also be possible to add a valueDialog() so that you
could enter a reduction percentage or decimal.

The usage in your case would go something like this.
Make your original image frame, load an image and adjust frame size
(presumably you want a proportional scaling).
Now run this script, creating the guides.
Adjust the scaling of your image (easy way is to lock the X-Y scaling,
then multiply one of the values by 0.8 -- add *0.8 to the spinbox and
press Return, it does the math for you and both values change since
they're locked).
Now adjust the X-Pos and Y-Pos in the Image tab so that your scaled down
image fits the guides. What would also work would be to add 10% of the
width of the frame to the X-Pos in Image and 10% of the height to Y-Pos
in Image.

If the guides are annoying afterward, either delete them or uncheck View
> Grids and Guides > Show Guides.

Greg




More information about the scribus mailing list