Scale an Image to Fill a Frame Proportionally
Jump to navigation
Jump to search
Scribus' Image Properties toolbar gives you the ability to "Scale to Frame Size: Proportional". This will proportionally scale the image to the largest size possible while still keeping the entire image within the confines of the frame: i.e., no cropping is done.
This script loops over every selected object, and for all image frames, it scales the image proportionally, filling the entire frame with your image. This means that some of the image will be cropped by the frame in either the horizontal or vertical dimension.
This script makes use of the getProperty(...) and setProperty(...) functions in order to access image properties that are not exposed by other functions. The script has been tested on Scribus 1.3.3.9 and 1.3.4.
from scribus import * if haveDoc(): nbrSelected = selectionCount() objList = [] for i in range(nbrSelected): objList.append(getSelectedObject(i)) for i in range(nbrSelected): try: obj = objList[i] props = "" propList = getPropertyNames(obj) for p in propList: props = props + p + " (" + str(getPropertyCType(obj, p) + "): " + str(getProperty(obj, p))) + "\n" messageBox("Property Info for " + obj, "Below is a property list for the selected object named " + obj + "\n" + props, ICON_INFORMATION) except WrongFrameTypeError: nothing = "nothing"