This method saves image data to a file.
ImageKit9ALib refers to the ANSI version, ImageKit9Lib refers to the Unicode version, (x86) refers to the 32 bit version, (x64) refers to the 64 bit version.
Parameters
Name | Explanation |
---|---|
Val | 0 (BMP - Uncompressed), 1 (BMP - Compressed), 2 (JPEG - Standard DCT), 3 (JPEG - Progressive DCT), 4 (GIF), 5 (TIFF - Uncompressed), 6 (TIFF - CCITTRLE), 7 (TIFF - GROUP3-1D), 8 (TIFF - GROUP3-2D), 9 (TIFF - GROUP4), 10 (TIFF - PACKBITS), 11 (TIFF - LZW), 12 (PNG), 13 (FPX - Uncompressed), 14 (FPX - Single Color Compressed), 15 (FPX - JPEG Compression), 16 (PCX), 17 (WMF), 18 (EMF), 19 (DXF), 20(SVG), 21(JPEG2000 Part1), 22(JPEG2000 Code Stream), 23(SXF p21), 24(SXF sfc), 25(TIFF JPEG), 26 (Exif - JPEG Standard DCT), 27 (Exif - JPEG Progressive DCT) |
ImageHandle | The image handle of the image data to be saved |
The following constants can also be used: (ikSaveBMP = 0, ikSaveBMPRLE = 1, ikSaveJPEG = 2, ikSaveJPEGProgress = 3, ikSaveGIF = 4, ikSaveTIFFNoncompressed = 5, ikSaveTIFFCcittrle = 6, ikSaveTIFFGroup3_1D = 7, ikSaveTIFFGroup3_2D = 8, ikSaveTIFFGroup4 = 9, ikSaveTIFFPackbits = 10, ikSaveTIFFLZW = 11, ikSavePNG = 12, ikSaveFPXNoncompressed = 13, ikSaveFPXSingleColor = 14, ikSaveFPXJpeg = 15, ikSavePCX = 16, ikSaveWMF = 17, ikSaveEMF = 18, ikSaveDXF = 19, ikSaveSVG = 20, ikSaveJPEG2000 = 21, ikSaveJPEG2000Stream = 22, ikSaveSXF P21 = 23, ikSaveSXFSFC = 24, ikSaveTIFFJPEG = 25, ikSaveJPEGExif = 26, ikSaveJPEFProgressExif = 27)
Return Value
Returns True (nonzero) if successful. Returns False (0) if unsuccessful.
Explanation
The SaveFile method saves image data to a file.
When the ImageHandle parameter contains a valid image handle
The image set in the ImageHandle parameter will be saved in the location specified by the FileName property.
When the ImageHandle parameter contains 0
The image referred to by the LayerNo property (either the image set in the ImageHandle property or the image set in the Layer(LayerNo).ImageHandle property as the case may be) will be saved in the location specified by the FileName property.
Below is a list of other properties that should be set when saving files in the these formats...
FPX | The Comment property should be set. If the Val parameter is 15 then the JpegQuality property should also be set. |
GIF | The Comment, GifAnime, GifAnimeDelay, Interlace, PalBlue, PalGreen, PalRed, and Transparent properties should be set. |
JPEG | The Comment, JpegQuality, and JpegSubsamp properties should be set. |
JPEG2000 | The Comment, JPEG2000CodeBlockHeight, JPEG2000CodeBlockWidth, JPEG2000NumrResLevel, JPEG2000PrecinctHeight, JPEG2000PrecinctWidth, JPEG2000Reversible, JPEG2000Size, JPEG2000TileHeight, and JPEG2000TileWidth properties should be set. |
PNG | The Comment, Interlace, PalBlue, PalGreen, PalRed, PngAlphaChannel, and Transparent properties should be set. When the PngAlphaChannel property is True, pass the image handle of the 32 bit RGBA image to the ImageHandle property. |
TIFF | The Comment and TiffAppend properties should be set. If the Val parameter is 5, 10, or 11 then the TiffColorSpace property should be set. If the Val parameter is 25, then the JpegQuality should be set. For all Tiff images other than GROUP4, the TiffSaveOneStrip property should be set. |
Exif | Exif |
In order to save vector image data as raster image data, the Vector.VectorToRaster method must be executed PRIOR to executing the SaveFile method. In other words, the vector image data must be converted to DIB image data before it can be saved in a raster image format.
To display a caption, message, and button in the Progress dialog box when loading or saving files, set the Caption, Message and ButtonName properties.
With certain raster image formats, it is only possible to save images of a particular bitcount. Errors can be generated if an image of unsupported bitcount is saved. Below is a list of supported bitcounts when saving each type of raster image.
Name | Explanation |
---|---|
BMP (Uncompressed) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
BMP (Compressed) | 4,8 |
JPEG (Standard DCT) | 8 bit grayscale, 24 |
JPEG (Progressive DCT) | 8 bit grayscale, 24 |
GIF | 1, 4, 8 |
TIFF (Uncompressed) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
TIFF (CCITTRLE) | 1 |
TIFF (GROUP3-1D) | 1 |
TIFF(GROUP3-2D) | 1 |
TIFF (GROUP4) | 1 |
TIFF (LZW) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
TIFF (PACKBITS) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
TIFF (JPEG) | 8 bit grayscale, 24 |
PNG | 1,4,8,24 |
FPX (Uncompressed) | 8 bit grayscale, 24 |
FPX (Single Color Compressed) | 8 bit grayscale, 24 |
FPX (JPEG Compression) | 8 bit grayscale, 24 |
PCX | 1,4,8,24 |
JPEG2000(Part1) | 8 bit grayscale, 24 |
JPEG2000(Code Stream) | 8 bit grayscale, 24 |
Exif (Standard DCT) | 8 bit grayscale, 24 |
Exif (Progressive DCT) | 8 bit grayscale, 24 |
Note: TIFF GROUP3-1D is the same as MH. TIFF GROUP3-2D is the same as MR. TIFF GROUP4 is the same as MMR. If images are saved in uncompressed TIFF, TIFF PACKBITS, or TIFF LZW formats as 16 bit images, they will be converted to 24 bit.
Sample code for converting a BMP image file into a 24 bit JPEG image file:
Visual Basic
ImageKit1.File.FileName = "Newtone.bmp"
ImageKit1.LayerNo = -1
If ImageKit1.File.LoadFile(ikLoadBMP) = False Then Exit Sub
If ImageKit1.GetImageType() = False Then Exit Sub
If ImageKit1.BitCount <> 24 Then
If ImageKit1.Effect.ConvertColor(24, False, False, 0) = False Then Exit Sub
End If
ImageKit1.File.JpegQuality = 75
ImageKit1.File.JpegSubsamp = ik411
ImageKit1.File.FileName = "Newtone.jpg"
ImageKit1.File.SaveFile(ikSaveJPEG, 0)
Differences from the ImageKit7 ActiveX
Files could only be saved to local or network drives. In the ImageKit9 ActiveX files can be saved to FTP servers or HTTP(S) servers.
Exif (JPEG) files could not be saved in the ImageKit7 ActiveX. The ImageKit9 can save Exif (JPEG) files
The ImageHandle argument type has changed.
Differences from the ImageKit8 ActiveX
The ImageHandle argument type has changed.