Omnis Externals
ImageLib Documentation
Am Image processing utility external for use
with Omnis Studio
Outline of ImageLib Library v0.3
The "ImageLib" external library provides users with
a means to resize image files and convert between image formats.
Static Methods
The library presents a set of static
external methods:
- character[] $versionInfo(): returns
a character array containing the control string: " ImageLib
version: MAJOR_VERSION_NUMBER . MINOR_VERSION_NUMBER ".
- character[] $demoInfo(): returns a character
array containing a string to indicate, where appropriate,
if the external has compiled as a demo version and the expiry
date of the demo.
- void $clearLastError(): Clears the contents
of the current error message
- character[] $getLastError(): Returns
a string describing the last detected error
- bool[] $hasregisterederror(): returns
a boolean indicating presence of current error message
Object Methods
The library presents a set of external
object methods:
- bool[] $readfile( character[] ): accepts
path of source image file and returns a boolean indicating
success of readfile operation.
- bool[] $writefile( character[] ): accepts
path of target image file, writes the image to file and returns
a boolean indicating success of file write operation.
- integer[] $filesize(): Returns size
(in bytes) of an initialised image
- bin[] $getas( character[] ): accepts
string describing desired image format (e.g. "JPG") and returns
a copy of the image as a binary blob in specified format
- bool[] $crop( character[] ): accepts
a geometry string (see below), crops an image (extracts a
sub-image) of the desired width and height, applying offsets
if desired and returns boolean to indicate success or failure
- bool[] $chop( character[] ): accepts
a geometry string (see below), chops an image (removes a sub-image)
of the desired width and height, applying offsets if desired
and returns boolean to indicate success or failure
- integer[] $columns(): Returns the
number of columns (pixel width) in this image
- integer[] $rows(): Returns the number
of rows (pixel height) in this image
- bool[] $setfrom( binary[] ): accepts
a binary blob containing an image in a supported format, Initialises
this image using the binary blob and returns
a boolean indicating success or failure.
- integer[] $getdepth(): Returns
the colour depth of the image (8 or 16 bits)
- bool[] $setdepth( integer[] ): accepts
an integer of value equal to the desired depth, sets the colour
depth of the image (to 8 or 16 bits)
and returns a boolean indicating
success or failure.
- bool[] $sample( character[] ): accepts
an extended geometry string indicating the desired height,
width of the output along with any optional flags (e.g. <,>,!,%
- see geometry strings), resizes the image, using a pixel
sampling algorithm, and returns boolean indicating success
or failure. This method performs interpolation and will give
better quality results than the $scale method.
- bool[] $scale( character[] ): accepts
an extended geometry string indicating the desired height,
width of the output along with any optional flags (e.g. <,>,!,%
- see geometry strings), resizes the image, using a simple
ratio algorithm, and returns boolean indicating success or
failure.
- bool[] $rotate( real[] ): accepts
a real number indicating the desired angle of rotation (in
degrees), Rotates the pixels within the image canvas and returns
a boolean indicating success or failure.
- bool[] $quality( integer[] ): accepts
an integer specifying the desired quality, adjusts the output
quality of images for those formats that support this operation
//(JPG, MIFF and PNG). The permitted range is [0,100] with
a default value of 75. Returns a boolean
indicating success or failure.
- bool[] $isvalid():Describes whether
the image object is in a valid (viewable) state or not. Returns
a boolean describing the state of the object
Geometry strings are of the format: "<width>x<height>{+-}<xoffset>{+-}<yoffset>"
Extended geometry strings are of the format:
"<width>x<height>{+-}<xoffset>{+-}<yoffset>{%}{!}{<}{>}"
where geometry qualifiers indicate the following:
|
Qualifier
|
Description
|
|
%
|
Interpret width and height as a percentage of the
current size. |
|
!
|
Resize to width and height exactly, loosing original
aspect ratio. |
|
<
|
Resize only if the image is smaller than the geometry
specification. |
|
>
|
Resize only if the image is greater than the geometry
specification. |

|
|