Fitting an Image to its Frame

We have some built-in functions in Scribus to Adjust Image to Frame, and also Adjust Frame to Image. What if you have a situation where you have a frame of a set size, and must fill it, even though you end up cropping the edge a bit? It's certainly possible to do, but a bit fiddly.

Here is a script that will make sure an image fills either the height or width, by your choice. It does this by temporarily expanding the frame, calling setScaleImageToFrame to say to scale to the frame, then immediately calls the function again to say don't scale to the frame. After this, the frame is returned to its original dimensions, and since its in Free Scaling mode, the image scale stays the same.

This may be hard to understand verbally, but will be obvious once you run the script. If you make a mistake in the direction, just run the script again.

fitimage2frame_v2.py
Here is another version, taking a cue from Christian Mandel on the mail list. This time, we first scale the image frame, but not proportionally, then take the higher scale value (X-scale vs. Y-scale) as the value to assign in both directions. An advantage of this method is that will work regardless of the proportions of the image.