OpenWGA 7.6 - TMLScript reference
Object:
ImageScaler
Description |
The ImageScaler is a tool object to scale and convert image files from TMLScript. It is using the Java Advanced Imaging API plus some custom filters, offering an easy to use interface for these tasks. An ImageScaler is created via method WGA.createImageScaler() taking an image file as parameter. The data of the image is loaded to the scaler ready to be scaled by the available methods. The modified image then again can be put out as regular file via scaler.writeImage() or attached to a document using this.attachScaledImage(). The capabilities of the ImageScaler object, especially which formats it can read and write, is dependent on the capabilities of the Java Advanced Imaging API. However on most platforms the valid input formats are JPEG, PNG and BMP (Windows Bitmap). Usable output formats are JPEG (the default) and PNG. See further information about this API on the homepage of the Java Advanced Imaging API or the Java Advanced Imaging API Programming Guide. |
||||||||||||||||||||||||||||||||||||||
Retrieval |
WGA.createImageScaler() |
||||||||||||||||||||||||||||||||||||||
Allowed in script types |
|
||||||||||||||||||||||||||||||||||||||
Properties and methods |
|
||||||||||||||||||||||||||||||||||||||
Examples |
The following example processes an image file that is uploaded from a WebTML form. The image is scaled so that it does not exceed a maximum size of 800x600 pixels, while keeping the ratio.The actual result size therefor will be lower than the given values on one dimension. First ther form to upload the file: <tml:form id="uploadImage"> Then the code of the action: The method tmlform.getFile() is used to get a regular file object for the uploaded file, which is neccessary to pass it on to the scaler. In this example the method this.attachScaledImage() is used to directly attach the modified data in the Scaler to the current context document. Note the omitted suffix on the output file name. <tml:action id="scale"> |