The Free, Quality Image library for Windows
ActiveX-Library: Freeimage.Image
Design and implementation by
Markus Loibl
(markus.loibl@epost.de)
This file is part of FreeImage 2.6.0
Samples
Opening and saving
Option explicit
dim ctrl
dim erg
set ctrl = CreateObject("FreeImage.Image")
ctrl.Test "Opening earth.jpg and saving as a tiff .... ", "FreeImage.Image"
erg = ctrl.Open("earth.jpg")
MsgBox "Opening file result: " + CStr(erg)
erg = ctrl.Save("earth.tif")
MsgBox "Saving file result: " + CStr(erg)
set ctrl = Nothing
Cloning
Option explicit
dim ctrl
dim ctrl2
dim erg
set ctrl = CreateObject("FreeImage.Image")
erg = ctrl.Open("earth.jpg")set ctrl2 = ctrl.Clone
ctrl.Test "first ok", "FreeImage.Image"
ctrl.Test "second ok", "FreeImage.Image"
set ctrl2 = Nothing
set ctrl = Nothing
Reference
|
|
Test | Shows a Message-Box (for testing and debugging purposes) |
| in | String | This string appears in the messagebox (message) |
| in | String | This string appears in the messagebox (title) |
File handling
|
|
Open | Loads an image. If an image is already opened, it will be closed. The image-format is calculated from the file's extension. If it is unknown, this function will fail. |
| in | String | Filename of image to load |
| out | short | 0: file couldn't be loaded 1: file sucessfully loaded |
|
|
OpenEx | Loads an image. If an image is already opnened,
it will be closed. If the filetype (extension) of the file is unknown, this function will fail. |
| in | short | Image-format |
| in | String | Filename of image to load |
| in | short | Additional parameter. They are specific to the file-format (e.g. decide which bitmap in the cabinet to load within PCD). See the freeimage-docu or sourcecode for more details! |
| out | short | 0: file couldn't be loaded 1: file sucessfully loaded |
|
|
Close | If an image is opened, it will be closed (without saving it). |
|
|
Save | Saves an opened image. The image will not be closed. The image-format is calculated from the file's extension. If it is unknown or no image is opened, this function will fail. |
| in | String | Filename of image to save |
| out | short | 0: file couldn't be saved 1: file sucessfully saved |
|
|
SaveEx | Saves an opened image. The image will not be closed. If no image is opened, this function will fail. |
| in | short | Image-format |
| in | String | Filename of image to save |
| in | short | Additional parameter. They are specific to the file-format (e.g. decide which compression-algorithm to save using TIFF or which compression-rate while saving JPEG). See the freeimage-docu or sourcecode for more details! |
| out | short | 0: file couldn't be saved 1: file sucessfully saved |
Image-Information
If no image is opened, the following functions and properties will fail.
|
|
ResolutionX | The horizontal image-resolution . |
| get/set | double | Resolution in [dpi] |
|
|
ResolutionY | The vertical image-resolution . |
| get/set | double | Resolution in [dpi] |
|
|
Width | The width of the image. |
| get | long | Width |
|
|
Height | The height of the image. |
| get | long | Height |
|
|
DIBSize |
Returns the size of the DIB-element of a opened image in memory. E.g. the BITMAPINFOHEADER + palette + data bits. |
| get | long |
|
|
RedMask |
Returns a bit pattern describing the red colour component of a pixel in an opened image. |
| get | long |
|
|
GreenMask |
dto. |
| get | long |
|
|
BlueMask |
dto. |
| get | long |
|
|
IsTransparent | Status of the transparency-table. |
| get | short | 1: transparency table is enabled 0: else |
Image-Conversions
|
|
Clone | Duplicates. A new image is generated. If no image is opened or the cloning fails, this function will fail. |
| out | Reference to a new Freeimage.Image |