Difference between revisions of "Scripter/Images"

From Scribus Wiki
Jump to: navigation, search
(Image Wizard: Scale and Align an Image)
(Image Wizard: Scale and Align an Image)
Line 15: Line 15:
  
 
[[File:ImageWizard3.png]]
 
[[File:ImageWizard3.png]]
 
+
You might also have a look at [[Align an Image in its Frame]] . This does the simple task of aligning an image in the frame, such as upper left corner or centering, again using tkinter, though here you can select multiple image frames at once before running the script.
* [[Align an Image in its Frame]]
 
 
* [[Automatic import of images from a directory using a script]]
 
* [[Automatic import of images from a directory using a script]]
 
* [[Automatic import of images: Versions not requiring Tkinter]]
 
* [[Automatic import of images: Versions not requiring Tkinter]]

Revision as of 14:36, 4 November 2016

This article is part of the Scripts series.

I decided to beef up this page a bit, since we get a number of questions about whether a script can be written for some task or other, and one quickly realizes that it takes some time to find all the scripts that deal with such a task. What people really need is a quick survey of what's out there, so that they can either modify some existing script themselves, or be able to ask for help with the modification for their particular needs.

I'll try to start with simple scripts first, then go to more complicated or perhaps esoteric ones down the page.

Import an image in the way office-programs do

This script does the simple task of taking an image file and making a standard image frame and loading it onto a page. In a modified state, it is one of the scripts included with Scribus, DirectImageImport.py.

The presumption is that you will then resize and reposition this image in most cases. One downside in the modified script is its need for PIL, the Python Imaging Library. The advantage of PIL is that you end up with a frame exactly dimensioned for the image, and importantly the frame ends in a state of scaled to frame proportionally, so resizing keeps the proportions.

Directimageimportresults.png

Image Wizard: Scale and Align an Image

With this idea that you have imported an image, but want to adjust various details about it, we come to Image Wizard. I confess I haven't tried this one to make sure it still works, but what it does is use tkinter to create a remote control-like structure for a number of manipulations as shown. While I can understand that for a Scribus novice this might seem a great tool, realistically most of these manipulations are easily done without a script. For example, right-clicking on an image frame brings up a context menu to adjust frame to image or image to frame. Flipping horizontally and vertically are one-click operations in the X,Y,Z tab.

ImageWizard3.png You might also have a look at Align an Image in its Frame . This does the simple task of aligning an image in the frame, such as upper left corner or centering, again using tkinter, though here you can select multiple image frames at once before running the script.