This method saves image data as raw data.
Parameters
Val
The image format used to save the image
This value is of type Newtone.ImageKit.SaveFileType
SaveImage
The saved image
Return Value
Returns True if successful. Returns False if unsuccessful.
Explanation
The SaveImageToRawData method saves image data as raw data.
When the SaveImage parameter contains a valid image handle
The image set in the SaveImage parameter will be saved as raw data and set into the RawData property.
When the SaveImage parameter contains 0
The image referred to by the LayerNumber property (either the image set in the Image property or the image set in the Layer(LayerNumber).Image property as the case may be) will be saved as raw data and set into the RawData property.
Note: When the LayerNumber property is -1, the image set in the Image property is enabled. When the LayerNumber property has values from 0 to 99, the image set in the Layer(LayerNumber).Image property is enabled.
Below is a list of other properties that should be set when saving files in the these formats...
Format | Explanation |
---|---|
FPX | The Comment property should be set. If the Val parameter is SaveFPXJpeg then the JpegQuality property should also be set. |
GIF | The Comment properties should be set. |
JPEG | The Comment, JpegQuality, and JpegSubsampling properties should be set. |
JPEG Progress | The Comment, JpegQuality, and JpegSubsampling properties should be set. |
JPEG2000 | The Comment, JPEG2000CodeBlockHeight, JPEG2000CodeBlockWidth, JPEG2000NumResLevel, JPEG2000PrecinctHeight, JPEG2000PrecinctWidth, JPEG2000Reversible, JPEG2000Size, JPEG2000TileHeight, and JPEG2000TileWidth properties should be set. |
PNG | The Comment property should be set. |
TIFF | The TiffAppend property should be set. After the image has been saved, please execute the CloseMultiTiff method. |
Though there are differences when saving raw image data, the process is nearly the same as the SaveImageToFile method.
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) |
24 bit color. 8 bit grayscale may be saved only with the
ImageKit.NET2 Plugin (Win32 Dll files) |
JPEG (Progressive DCT) | 8 bit grayscale, 24 |
GIF | 1, 4, 8 Note: If the ImageKit.NETs Plugin (Win32 Dll files) are not present, all images will be saved in 8 bit GIF |
TIFF (Uncompressed) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
TIFF (GROUP3-1D) | 1 |
TIFF (GROUP4) | 1 |
TIFF (PACKBITS) | 1 |
TIFF (LZW) | 1, 4, 8, 16, 24, 32 (Does not include 16 bit grayscale) |
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 |
JPEG2000 (Part1) | 8 bit grayscale, 24 |
JPEG2000 (Code Stream) | 8 bit grayscale, 24 |
Note: The following image formats are not supported by standard
.NET Framework. Therefore, the ImageKit.NET2
Plugin (Win32 Dll files) are required when saving images in:
BMP Compressed, Saving Jpeg 8 bit grayscale,
JpegProgressive, JPEG2000, FPX file formats.
WMF and EMF images cannot be read and displayed in standard .NET
framework but rather are converted to raster image data and
displayed. As such, even though the file extensions are .wmf or
.emf, these images can only be saved as raster images.
Example
Sample code for converting a BMP image file into a 24 bit JPEG image file:
[Visual Basic.NET] ImageKit1.File.FileName = "Newtone.bmp" If ImageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.LoadBMP) = 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.FileName = "Newtone.jpg" ImageKit1.File.SaveImageToRawData(Newtone.ImageKit.SaveFileType.SaveJPEG, Nothing) [Visual C#.NET] ImageKit1.File.FileName = "Newtone.bmp"; if (!ImageKit1.File.LoadImageFromFile(Newtone.ImageKit.LoadFileType.LoadBMP)) return; if (!ImageKit1.GetImageType()) return; if (ImageKit1.BitCount <> 24)) { if (!ImageKit1.Effect.ConvertColor(24, false, false, 0)) return; } ImageKit1.File.FileName = "Newtone.jpg"; ImageKit1.File.SaveImageToRawData(Newtone.ImageKit.SaveJPEG, null);