Fitting an Image to its Frame: Difference between revisions

From Scribus Wiki
Jump to navigation Jump to search
(Created page with "{{Scripting Index}} 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 o...")
(No difference)

Revision as of 01:59, 25 November 2015

This article is part of the Scripts series.

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.py