Difference between revisions of "Scripter/Images"

From Scribus Wiki
Jump to: navigation, search
(Import an image in the way office-programs do)
(Import an image in the way office-programs do)
Line 6: Line 6:
 
== [[Import an image in the way office-programs do]]==
 
== [[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.
 
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.
 +
 +
[[File:Directimageimportresults.png]]
  
 
== [[Image Wizard: Scale and Align an Image]]==
 
== [[Image Wizard: Scale and Align an Image]]==

Revision as of 14:21, 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