Description Saves a device independent bitmap in a file.
Usage RetVal = [BiDib.]SaveDIBInImageFormat FileName Dib Image Format Compression
Remarks RetVal Boolean True on success, otherwise False.
FileName String The destination file name.
Dib LONGLONG Device independent bitmap to save.
Image Integer The number of images starting from 0.
Format Integer File format of the destination file.
The Format parameter can have one of the following values:
Format |
Common name |
Description |
imgffTiff - 1 |
TIFF |
Tagged Image File Format. |
imgffPcx - 2 |
PCX |
Zsoft PCX file format |
imgffDcx - 3 |
DCX |
Zsoft DCX file format |
imgffGif - 4 |
GIF |
Graphics Intercange File format |
imgffTga - 5 |
TGA |
Targa Image file format |
imgffBmp - 6 |
BMP |
Windows Bitmap file format |
imgffWmf - 7 |
WMF |
Windows Metafile file format |
imgffClp - 8 |
CLP |
Windows Clipboard file format |
imgffCals - 12 |
CALS |
CALS file format |
imgffJpeg - 13 |
JPEG |
JPEG file format |
imgffPng - 14 |
PNG |
PNG file format |
imgffPdf - 18 |
|
Portable Document Format file format |
Compression |
Integer |
Method of compression. The value of this parameter depends on the file type you save. below is a list of possible values, depending on the file format: |
|||
|
|
TIFF: The Compression parameter can be one of the following values: |
|||
|
|
imgcmNoComp = 201 |
Uncompressed image. |
||
|
|
imgcmPackBits = 202 |
Byte-oriented run-length coding. |
||
|
|
imgcmLzw = 203 |
Lempel-Ziv & Welch coding. |
||
|
|
imgcmLzwDiff = 204 |
Differential Lempel-Ziv & Welch coding. |
||
|
|
imgcmCcittG2 = 205 |
CCITT Group 3 1dimensional NO EOL coding. |
||
|
|
imgcmCcittG31D = 206 |
CCITT Group 3 1dimensional coding. |
||
|
|
imgcmCcittG32D = 207 |
CCITT Group 3 2dimensional coding. |
||
|
|
imgcmCcittG4 = 208 |
CCITT Group 4 coding. |
||
|
|
imgcmJpeg = 209 |
JPEG coding. |
||
|
|
|
|||
|
|
PCX - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
DCX - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
GIF - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
TGA: The Compression parameter can be one of the following values: |
|||
|
|
0 - imgTgaUncomp |
Save image in uncompressed Format. |
||
|
|
1 - imgTgaComp |
Save image in compressed Format. |
||
|
|
BMP - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
EMF - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
CLP - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
CLS - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
JPEG - If the file format is specified as JPEG, the Compression parameter will specify the compression quality. The compression quality is a number between 1 and 100, lower number means stronger compression (and smaller file size) with more los of data, higher number means better quality (and larger file size) with less los of data. The recommended value is 75. |
|||
|
|
PNG - The Compression parameter is ignored for this file type, pass a 0 (zero) to the function. |
|||
|
|
PDF. The Compression parameter can be one of the following values: |
|||
|
|
pdfNoComp = 32 |
No compression. |
||
|
|
pdfFlate = 512 |
Flate compression. |
||
|
|
pdfRunLength = 1024 |
Runlength compression. |
||
|
|
pdfCCITT = 2048 |
CCITT fax compression. |
||
|
|
pdfJPEG = 4096 |
JPEG compression. (When JPEG compression inside PDF files is selected, the loss ratio is set to the default 75) |
||
Call BitmaniError method to retrieve the error code.
Available error codes: |
||
Error Code number |
Error Code |
Meaning |
0 |
LS_OK |
Operation was successful. |
Error codes for saving Bitmap, ColorFax, WMF, EMF and Clipboard files: |
||
1 |
LS_INOTENOUGHMEMORY |
Not enough memory to allocate block. |
2 |
LS_IDCCREATEERROR |
Unable to create DC. |
3 |
LS_IFILEOPENERROR |
Can’t open the file. |
4 |
LS_IFILEIOERROR |
General I/O error in reading or writing. |
5 |
LS_ICLIPOPENERROR |
Can’t open clipboard. |
6 |
LS_ICLIPRECERROR |
Could not receive from clipboard. |
7 |
LS_IBITCOPYERROR |
Can’t copy bits from bitmap. |
8 |
LS_IPARAMETERERROR |
Parameter error. |
9 |
LS_IFILEFORMAT |
Invalid file format. |
10 |
LS_ICREATEPALETTE |
Can’t create palette. |
11 |
LS_ICREATEBITMAP |
Can’t create bitmap. |
12 |
LS_IMETAMAPMODEERROR |
Mapping mode is improperly set in metafile. |
13 |
LS_IINVALIDBITSPIXEL |
Invalid bit/pixel value. |
14 |
LS_IFORMATNOTFOUND |
Format not found in clipboard file. |
15 |
LS_IGETOBJECT |
Can’t get bitmap parameters. |
16 |
LS_IMETAERROR |
Can’t create metafile. |
17 |
LS_ILOCKMEMORY |
Can’t lock global memory. |
18 |
LS_IDIBCOMPRESSED |
DIB must be uncompressed. |
19 |
LS_ISIZEERROR |
Invalid DIB size. |
20 |
LS_IREJECTPARAM |
Parameter error in Dithering. |
21 |
LS_IBADBITPIXEL |
Bad bit/pixel value in DIB header. |
22 |
LS_IBADCAPIXPARAM |
The CAPIX algorithm creates only 1 or 4 bit image. |
23 |
LS_IMG_PRINTERDC |
Could not get printer DC. |
24 |
LS_IMG_PRINTERRASTER |
Device not capable to handle raster. |
25 |
LS_IMG_PRINTERAPPDC |
Could not get display DC. |
26 |
LS_IMG_PRINTERESC4 |
Escape failed SETABORTPROC. |
27 |
LS_IMG_PRINTERESC5 |
Escape failed STARTDOC. |
28 |
LS_IMG_PRINTERESC6 |
Escape failed NEXTBAND. |
29 |
LS_IMG_CLIPBOARD |
Clipboard error. |
30 |
LS_IMG_PRINTCANCEL |
User canceled the printing. |
31 |
LS_INOTHINGTODO |
Nothing to do. |
32 |
LS_IPAGENOTFOUND |
Unable to find a scanned page for cropping. |
Error codes for saving TIFF and CALS files: |
||
33 |
LS_TNOTENOUGHMEMORY |
Not enough memory to allocate block. |
34 |
LS_TBADOPENMODE |
No T_READ or T_CREAT in OpenTiffFile(). |
35 |
LS_TINDEXOUTOFRANGE |
Image or tag data index is out of range. |
36 |
LS_TSTRIPOUTOFRANGE |
Strip index is out of range. |
37 |
LS_TENDOFDATA |
Unexpected end of file in reading data. |
38 |
LS_TFILEIOERROR |
General I/O error in reading or writing. |
39 |
LS_TPATHTOOLONG |
Pathname is longer than MAXPATH. |
40 |
LS_TNOTTIFFILE |
File does not have a valid TIFF format. |
41 |
LS_TBADTAG |
Invalid TIFF directory tag. |
42 |
LS_TTOOFEWINFO |
Indispensable tags are missing. |
43 |
LS_TUNKNOWNCOMPRESSION |
Image compression type is not known. |
44 |
LS_TCOMPRESSIONFAILED |
Error during compression or decompression. |
45 |
LS_TNOSUCHTAG |
Such tag is not defined. |
46 |
LS_TBADBYTEORDER |
Invalid byte order ID in ModiTiffFileInfo(). |
47 |
LS_TBADBITORDER |
Invalid BITORDER tag value. |
48 |
LS_TBADNUMBEROFCOLORS |
Invalid BITSPERPIXEL tag value. |
49 |
LS_TTOFEWCOLORINFO |
Color info is not enough. |
50 |
LS_TNOTCALSFILE |
File does not have a valid CALS format. |
51 |
LS_TNOEOFB |
End of Facsimile Block is missing (EOFB). |
52 |
LS_TBADEOFB |
Unexpected End of Facsimile Block (EOFB). |
53 |
LS_TBADWIDTH |
Image width must be 1728 pixels (Can’t save it). |
54 |
LS_TNOJPEGDLL |
Module JPEG DLL is not found. |
55 |
LS_TBADJPEGDLL |
Can’t find a function in module JPEG DLL. |
56 |
LS_TFORMATCLIPBOARD |
Clipboard format is not bitmap. |
57 |
LS_TOPENCLIPBOARD |
Could not open clipboard. |
58 |
LS_TRECEIVECLIPBOARD |
Could not receive bitmap from clipboard. |
59 |
LS_TIMAGENOTREGISTERED |
Image is not registered. |
60 |
LS_TNOBIDLGS |
BiDlgs.dll does not exist. |
Error codes for saving PCX and DCX files: |
||
61 |
LS_PCX_BUF_ALLOC |
Unable to allocate buffers. |
62 |
LS_PCX_UNKNOWN_VERSION |
Uninterpreatable version. |
63 |
LS_PCX_UNKNOWN_ENCODING |
Possibly PCX, but doesn’t use ZSoft encoding. |
64 |
LS_PCX_FILEOPEN |
Unable to open file. |
65 |
LS_PCX_BITMAP |
Unable to create bitmap. |
66 |
LS_PCX_CLIP_OPEN |
Unable to open clipboard. |
67 |
LS_PCX_HDC |
Unable to create compatible DC. |
68 |
LS_PCX_TOO_SPECIAL_FORMAT |
Too hardware dependent bitmap. |
69 |
LS_PCX_BAD_PALETTE |
Error in reading palette info. |
70 |
LS_PCX_ERROR_GLOCK |
Global and local lock error. |
71 |
LS_PCX_ERROR_GALLOC |
Global and local alloc error. |
72 |
LS_PCX_ERROR_USERFUNC |
User function return with FALSE. |
73 |
LS_PCX_ERROR_BITMAPFORMAT |
PCX file and bitmap is not the same type. |
74 |
LS_PCX_ERROR_GETCLIPBOARD |
Error in GetClipboardData function. |
75 |
LS_PCX_ERROR_READ |
Error in _lread. |
76 |
LS_PCX_ERROR_WRITE |
Error in _lwrite. |
77 |
LS_PCX_ERROR_IO |
File I/O error. |
78 |
LS_PCX_ERROR_COLORSPACE |
Invalid color space format. |
79 |
LS_DCX_ERROR_INVALIDITEM |
Reference to non-existent item number. |
80 |
LS_DCX_ERROR_BADFILETYPE |
Bad DCX file identifier. |
81 |
LS_DCX_ERROR_BADOFFSET |
Bad item offset in DCX header. |
82 |
LS_DCX_ERROR_DISKSPACE |
Not enough disk space for file operation. |
83 |
LS_DCX_ERROR_DCXFULL |
No empty entry in DCX header. |
84 |
LS_DCX_ERROR_DELETEFILE |
Unable to delete file. |
85 |
LS_DCX_ERROR_RENAMEFILE |
Unable to rename file. |
86 |
LS_DCX_ERROR_EMPTY |
No image in DCX-file. |
Error codes for saving GIF files: |
||
87 |
LS_GNOTENOUGHMEMORY |
Not enough memory to allocate block. |
88 |
LS_GBADOPENMODE |
No G_READ or G_CREAT in OpenGifFile(). |
89 |
LS_GINDEXOUTOFRANGE |
Image index is out of range. |
90 |
LS_GENDOFDATA |
Unexpected end of file in reading data. |
91 |
LS_GFILEIOERROR |
General I/O error in reading or writing. |
92 |
LS_GPATHTOOLONG |
Pathname is longer than MAXPATH. |
93 |
LS_GNOTGIFFILE |
File does not have a valid GIF format. |
94 |
LS_GCOMPRESSIONFAILED |
Error during compression or decompression. |
95 |
LS_GBADNUMBEROFCOLORS |
Invalid BITSPERPIXEL value. |
96 |
LS_GCLIPOPEN |
Can’t open clipboard. |
Error codes for saving TGA files: |
||
97 |
LS_TGA_ERROR_GALLOC |
Error during global alloc. |
98 |
LS_TGA_ERROR_GLOCK |
Error during global lock. |
99 |
LS_TGA_ERROR_LALLOC |
Error during local alloc. |
100 |
LS_TGA_ERROR_LLOCK |
Error during local lock. |
101 |
LS_TGA_ERROR_ORIG_GALLOC |
Error during global alloc for TGAOriginalFile. |
102 |
LS_TGA_ERROR_ORIG_GLOCK |
Error during global lock for TGAOriginalFile. |
103 |
LS_TGA_ERROR_SCAN_GALLOC |
Error during global alloc for ScanLineTable. |
104 |
LS_TGA_ERROR_SCAN_GLOCK |
Error during global lock for ScanLineTable. |
105 |
LS_TGA_ERROR_EXT_GALLOC |
Error during global alloc for TGAExtDevArea. |
106 |
LS_TGA_ERROR_EXT_GLOCK |
Error during global lock for TGAExtDevArea. |
107 |
LS_TGA_ERROR_EXT_SIZE |
Extension area size incorrect. |
108 |
LS_TGA_ERROR_FILLEXT |
Error during filling up extension are struct. |
109 |
LS_TGA_ERROR_DEV_GALLOC |
Error during global alloc for Developer Area. |
110 |
LS_TGA_ERROR_DEV_GLOCK |
Error during global lock for Developer Area. |
111 |
LS_TGA_ERROR_STAMP_GALLOC |
Error during global alloc for Postage Stamp. |
112 |
LS_TGA_ERROR_STAMP_GLOCK |
Error during global lock for Postage Stamp. |
113 |
LS_TGA_ERROR_CORR_GALLOC |
Error during global alloc for Correction Table. |
114 |
LS_TGA_ERROR_CORR_GLOCK |
Error during global lock for Correction Table. |
115 |
LS_TGA_ERROR_FILE_CORRUPTED |
File corrupted or incorrect format. |
116 |
LS_TGA_ERROR_NEWFILE_CORRUPTED |
New TGA file corrupted or incorrect format above Original Area. |
117 |
LS_TGA_ERROR_NOT_NEW_FORMAT |
The given function cannot operate on original or unknown TGA file format. |
118 |
LS_TGA_ERROR_NOT_ENCODED |
User hasn’t run EncodeTGAFile function. |
119 |
LS_TGA_ERROR_BITMAP |
Error in data of BitmapInfoHeader. |
120 |
LS_TGA_ERROR_IMAGETYPE |
Unknow TGA image type. |
121 |
LS_TGA_ERROR_NO_CLRMAP |
No color map data in TGA file. |
122 |
LS_TGA_ERROR_NO_EXTAREA |
No extension area in TGA file. |
123 |
LS_TGA_ERROR_NO_DEV |
No developer area in TGA file. |
124 |
LS_TGA_ERROR_NO_CLRCORR |
No color correction table in TGA file. |
125 |
LS_TGA_ERROR_NO_STAMP |
No Postage Stamp Data in TGA file. |
126 |
LS_TGA_ERROR_BUF_GALLOC |
Buffer alloc error. |
127 |
LS_TGA_ERROR_BUF_GLOCK |
Buffer lock error. |
128 |
LS_TGA_ERROR_CONV |
Conversation error. |
129 |
LS_TGA_ERROR_SCANLINE_GALLOC |
No space for scan line table. |
130 |
LS_TGA_ERROR_HDC |
hDC error. |
131 |
LS_TGA_ERROR_PALETTE |
Palette creating error. |
132 |
LS_TGA_ERROR_SET_DIBITS |
SetDIBits error. |
133 |
LS_TGA_ERROR_GET_DIBITS |
GetDIBits error. |
134 |
LS_TGA_ERROR_CREAT_BITMAP |
CreateDIBitmap error. |
135 |
LS_TGA_ERROR_IO |
File I/O error. |
136 |
LS_TGA_ERROR_DOSFILE |
Must be added to dos error code. |
Error codes for saving PNG files: |
||
137 |
LS_PNGERR_CREATE |
Unable to create file. |
138 |
LS_PNGERR_OPEN |
File not found. |
139 |
LS_PNGERR_MEMORY |
Not enough memory. |
140 |
LS_PNGERR_HANDLE |
Invalid bitmap or DIB handle. |
141 |
LS_PNGERR_READING |
Error occured while loading. |
142 |
LS_PNGERR_WRITING |
Error occured while saving. |
143 |
LS_PNGERR_CREATEDIBITMAP |
Unable to create DIB. |
144 |
LS_PNGERR_GETDIBITS |
Unable to get DIB. |
145 |
LS_PNGERR_PALETTE |
Palette missing. |
146 |
LS_PNGERR_BITDEPTHORALPHA |
Unsupported bit depth or alpha channel exist. |
Error codes for saving PDF files: |
||
147 |
LS_WINAPI_GETLASTERROR |
Error occured, call the Windows API GetLastError() for the error code. |
148 |
LS_INVALID_HANDLE_VALUE |
Invalid handle value. |
149 |
LS_FILE_ALREADY_EXISTS |
The file already exists. |
150 |
LS_INVALID_IMAGE_SIZE |
Invalid image size. |
151 |
LS_INVALID_BITSPERPIXEL |
Invalid bit/pixel value. |
152 |
LS_INVALID_STRING |
Invalid string. |
153 |
LS_NULL_POINTER |
Null pointer. |
154 |
LS_ZERO_BYTES_TO_WRITE |
Zero bytes to write. |
155 |
LS_INVALID_DPI |
Invalid DPI value. |
156 |
LS_MEMORY_ALLOCATION_ERROR |
Memory allocation error. |
157 |
LS_OBJECT_ALREADY_EXISTS |
The Object already exists. |
158 |
LS_TOO_MANY_OBJECTS |
Too many objects. |
159 |
LS_INVALID_RESOURCE_TYPE |
Invalid resource type. |
160 |
LS_INVALID_STREAM_SIZE |
Invalid stream size. |
161 |
LS_FILTER_NOT_SUPPORTED |
The filter is not supported. |
162 |
LS_NEGATIVE_VALUE |
Negative value. |
163 |
LS_TEMP_DIRECTORY_ERROR |
Temp directory error. |
164 |
LS_TEMPFILE_ERROR |
Temp file error. |
165 |
LS_INVALID_TIFF_DLL |
Invalid Tiff dll. |
166 |
LS_ENCODING_FAILED |
Encoding failed. |
167 |
LS_INVALID_JPEG_DLL |
Invalid Jpeg dll. |
168 |
LS_INVALID_PARAMETER |
Invalid Parameter |
169 |
LS_OPEN_FILE_ERROR |
Error opening file. |
170 |
LS_NOT_PDF_FILE |
File is not a PDF file. |
171 |
LS_PDF_VERSION_NOT_SUPPORTED |
PDF version is not supported. |
172 |
LS_READ_FILE_ERROR |
Error reading file. |
173 |
LS_ERROR_DURING_DECOMPRESSION |
Error during decompression. |
174 |
LS_INVALID_PALETTE |
Invalid palette. |
175 |
LS_COMPRESSION_NOT_SUPPORTED |
Compression is not supported. |
176 |
LS_CCITT_DECODING_FAILED |
CCITT decoding failed. |
177 |
LS_INVALID_PAGE_NUMBER |
Invalid page number. |
178 |
LS_PDF_OBJECT_NOT_INITIALIZED_USE_INITPDF |
PDF Object not initialized. |
179 |
LS_UNSPECIFIED_ERROR |
|
See Also
SaveDIBInImageFormatExt Method