The LOADFILEOPTION structure specifies extra options for reading an image file.
typedef struct _LOADFILEOPTION
{
L_UINT uStructSize;
L_INT XResolution;
L_INT YResolution;
L_UINT Flags;
L_INT Passes;
L_INT PageNumber;
L_UINT GlobalLoop;
L_IFDTYPE IFD;
L_UINT uRedScan;
L_UINT uGreenScan;
L_UINT uBlueScan;
L_UINT Flags2;
L_VOID *pFilterData;
L_SIZE_T uFilterDataSize;
L_INT nFilter;
L_INT nAttachment;
} LOADFILEOPTION, * pLOADFILEOPTION;
Size of the LOADFILEOPTION structure. This should be sizeof(LOADFILEOPTION). You must fill this member.
Horizontal dots per inch.
Vertical dots per inch.
Any of the following flags. (Use a bitwise OR to specify more than one value.)
Value | Meaning |
---|---|
ELO_REVERSEBITS | [0x00000001] Reverse the bit order when writing CCITT Group 3 and 4 files, so that the least significant bit (LSB) is first. |
ELO_GLOBALBACKGROUND | [0x00000002] Save a GIF file with the global background color specified by the GlobalBackground field. |
ELO_GLOBALPALETTE | [0x00000004] Save a GIF file with the global palette specified by the GlobalPalette field. |
ELO_GLOBALLOOP | [0x00000008] Enable looping when loading an animated file. This flag must be on for the GlobalLoop field to be used. |
ELO_ROTATED | [0x00000010] Load files without rotating them. This affects files that can be saved with a rotated view perspective. For more information refer to Accounting for View Perspective. |
ELO_IGNOREVIEWTRANSFORMS | [0x00000020] Load a Flash-Pix file without being modified by the viewing transforms. |
ELO_IGNORECOLORTRANSFORMS | [0x00000040] Load a Flash-Pix file without being modified by the color transforms. |
ELO_SIGNED | [0x00000080] Indicate that the bitmap can contain negative pixel values. |
ELO_DISABLEMMX | [0x00000100] Do not use MMX optimized code |
ELO_DISABLEP3 | [0x00000200] Do not use P3-specific optimized code. |
ELO_USEIFD | [0x00000400] Use the IFD offset. |
ELO_FORCECIELAB | [0x00000800] (JPEG only) The file has CIELAB colorspace |
ELO_USEBADJPEGPREDICTOR | [0x00001000] (JPEG only) Load lossless JPEG file using an incorrect predictor |
ELO_IGNOREPHOTOMETRICINTERP | [0x00002000] (TIFF only) Use RGB colorspace instead of the PhotometricInterpretation stored in the file. Use this to disable the color conversion to RGB during the load process. |
ELO_FORCERGBFILE | [0x00004000] (JPEG only) The file has RGB colorspace. |
ELO_MULTISPECTRALSCAN | [0x00008000] Use uXXXScan values information when loading NITF files. |
ELO_NOPALETTE | [0x00010000] Use the new palette mechanism. Do not use GDI memory to store the palette. |
ELO_IGNOREVIEWPERSPECTIVE | [0x00200000] (TIF and Exif only) Ignore the view perspective stored in the file and load the file as TOP_LEFT. If you are loading a TIF or Exif file that looks rotated or flipped, try setting this flag before loading the file. |
ELO_USEFASTCONVERSION | [0x00400000] (TIF and JPEG only) Use the fast color conversions when loading CMYK or CIELab files. Setting this flag will greatly speed up the loading of CMYK and CIELab files, but it will reduce the image quality. |
ELO_ALPHAINIT | [0x01000000] Initialize the alpha channel for 32- or 64-bit color images to all ones (0xFF for 8-bit alpha channels and 0xFFFF for 16-bit alpha channels). |
If this flag is not specified then: | |
- If the source bitmap has alpha values, they will remain unchanged in the loaded bitmap. | |
- If the source bitmap has no alpha values, the alpha values in the loaded bitmap will be initialized to all ones (0xFF for 8-bit alpha channels and 0xFFFF for 16-bit alpha channels). | |
The default value for LOADFILEOPTION.Flags includes this flag. | |
This flag is ignored when loading the following formats: | |
- FILE_TIF | |
- FILE_TIFLZW | |
- FILE_TIF_CMYK | |
- FILE_TIFLZW_CMYK | |
- FILE_TIF_PACKBITS | |
- FILE_TIF_PACKBITS_CMYK | |
- FILE_TIF_YCC | |
- FILE_TIFLZW_YCC | |
- FILE_TIF_PACKBITS_YCC | |
- FILE_TIF_J2K | |
- FILE_TIF_ZIP | |
- FILE_PNG | |
- FILE_PNG_ICO | |
- FILE_PSD | |
ELO_PREMULTIPLY_ALPHA | [0x40000000] Premultiply the alpha values when loading the image data. Only used when loading PNG and PSD files that have alpha information. |
ELO_LOADCORRUPTED | [0x00010000] Attempt to load corrupted files. |
ELO_NITF_USE_MAX | [0x00040000] (NITF Only) Use the maximum width and height. |
ELO_NITF_USE_MONODARK | [0x00080000] (NITF Only) Use the mono dark process (to brighten the resulting bitmap). |
ELO_NITF_SHOW_OBJECT | [0x00100000] (NITF Only) Make the object CGM available if it exists. |
ELO_IGNORE_ADOBE_COLOR_TRANSFORM | [0x04000000] Ignore the Adobe marker containing color transformations. Set this flag to load corrupt files with wrong APPE marker which have incorrect colors. |
ELO_ALLOW13BITLZWCODE | [0x08000000] Try to decode buggy LZW TIF files that contain 13-bit LZW codes. |
ELO_VECTOR_CONVERTED_UNITS | [0x10000000] Use converted units, instead of the input file's default. |
ELO_LOADOLDJBIG2FILES | [0x20000000] Load old JBIG2 files generated by LEAD JBIG2 filter. |
The number of passes (scans over the image) when loading or saving a progressive JPEG or LEAD CMP file. (This value is also used when loading interlaced PNG files.) (This value is also used when loading JBIG files to determine the number of resolutions to load to create a progressive load effect.)
Possible values when loading a progressive file:
Any positive number | Call the FILEREADCALLBACK function the specified number of times. |
---|---|
CALLBACK_ONCE | [0] Call the FILEREADCALLBACK function only once at the end. |
CALLBACK_WHEN_MEANINGFUL | [-1] Call the FILEREADCALLBACK function only on significant scans. (This is usually the best option.) |
CALLBACK_ALWAYS | [-2] Call the FILEREADCALLBACK function for the default number of scans. |
The page number of a multipage file, which can contain more than one image. When loading a file, this is the exact page number. For more information on multipage files refer to Multipage File Formats.
Loop count when playing an animation. Use 0 for continuous looping. For no looping, turn off the ELO_GLOBALLOOP flag in the Flags field.
Offset within a TIFF file where a page starts. This serves as a reference page for loading pages to a large TIFF file.
According to specifications, the minimum value for the first IFD is 8 for TIFF files and 16 for BigTIFF files.
(NITF only) Index of the scan to be loaded for the red component. Used only if ELO_MULTISPECTRALSCAN is set.
(NITF only) Index of the scan to be loaded for the green component. Used only if ELO_MULTISPECTRALSCAN is set.
(NITF only) Index of the scan to be loaded for the blue component. Used only if ELO_MULTISPECTRALSCAN is set.
Any of the following flags. (You can use a bitwise OR to specify more than one value.)
Value | Meaning |
---|---|
ELO2_MULTITHREADED | [0x00000001] Use multi-threaded code to load JPEG or CMP files. |
ELO2_USEFILTERDATA | [0x00000004] Use the filter data information (pFilterData, uFilterDataSize, nFilter) to speed up processing. |
See the Using Filter Data to Speed up Loading Large Files topic for more information. | |
ELO2_PREFERVECTOR | [0x00000008] Use vector processing, if supported. |
ELO2_AUTOFIXBITMAPRESOLUTION | [0x00000010] Automatically correct bitmap resolutions using the L_SetAutoFixBitmapResolutionOptions settings. |
ELO2_IGNORE_EMBEDDED_ICC_PROFILE | [0x00000020] Ignore the ICC profile embedded in the file (if any) - useful mainly for loading TIFF/JPEG CMYK/LAB files. |
Some files with CMYK or CieLAB data might contain embedded ICC profiles. These files are supposed to be viewed using these profiles to convert the CMYK/CieLAB data to BGR. LEADTOOLS v20 and later uses these embedded ICC profiles by default. LEADTOOLS v19 and prior ignored these profiles and used a standard CMYK profile to convert to BGR. | |
Exif, JPEG and TIFF files are the most common file formats containing such embedded ICC profiles. | |
Set the ELO2_IGNORE_EMBEDDED_ICC_PROFILE flag when loading file to ignore embedded ICC profiles. This will ensure backwards compatibility with earlier versions of LEADTOOLS. | |
ELO2_NO_IMAGE_DATA_CONVERSION | [0x000000040] Do not convert float or signed image data. Useful for getting the original floating point values stored in the source file without conversion. |
Setting this flag will prevent the floating point data from being converted to integer. But the bitmap generated will be of limited use. See Working with floating point bitmaps for more details. |
Pointer to a filter data structure used to speed up processing (loading, getting the file information, etc). Used only if Flags2 contains the ELO2_USEFILTERDATA flag. The filter data is retrieved by passing the FILEINFO_USEFILTERDATA flag to L_FileInfo. If not NULL, free it using L_FreeFilterData when it is no longer needed.
See the Using Filter Data to Speed up Loading Large Files topic for more information.
Size of the filter data. Used only if Flags2 contains the ELO2_USEFILTERDATA flag. The filter data is retrieved by passing the FILEINFO_USEFILTERDATA flag to L_FileInfo.
If 0, it is possible that the filter data contains handles or pointers that are valid only in the current process. Also, if 0, the filter data can be used only in one thread at a time. Currently, this is the case for most filters.
If not 0, the filter data is flat and can be saved to disk and reloaded later.
See the Using Filter Data to Speed up Loading Large Files topic for more information.
The filter that allocated the filter data. Used only if Flags2 contains the ELO2_USEFILTERDATA flag. The filter data is retrieved by passing the FILEINFO_USEFILTERDATA flag to L_FileInfo.
See the Using Filter Data to Speed up Loading Large Files topic for more information.
1-based attachment number to load. This is currently used only if this LOADFILEOPTION
instance is passed to L_ExtractAttachment.
pLOADFILEOPTION is a pointer to an LOADFILEOPTION structure. Where the function parameter type is pLOADFILEOPTION, you can declare a LOADFILEOPTION variable, update the structure's fields, and pass the variable's address in the parameter. Declaring a pLOADFILEOPTION variable is necessary only if your program requires a pointer.
Load a stamp image by calling the L_ReadFileStamp function.
If ELO_SIGNED is set, the bitmap can contain negative pixel values. This can cause the image to be incorrectly painted when it is loaded. In order to load correctly, you must call L_ClearNegativePixels before loading the image. If ELO_SIGNED is not set, any negative pixels in the image will be cleared internally.
Notes:
Loading JBIG files behaves as follows:
1) If only one resolution exists in the JBIG File, then the FILEREADCALLBACK function will be called with the image data for that resolution as it is decompressed.
2) If the image contains more than one resolution and (Passes >= nResolutions, where nResolutions represents the number of resolutions present in the file,) then FILEREADCALLBACK function will be called with the image data from the lowest resolution available in the file. The data that gets passed to the callback and/or inserted into the bitmap handle will be padded to the remaining width (that is, the size of the last resolution available in the file) with 0s. This will be repeated nResolution times, until the entire image (that is, the last resolution available) is loaded. Setting nPasses to CALLBACK_WHEN_MEANINGFUL or CALLBACK_ALWAYS has the same effect.
3) If the image contains more than one resolution and (Passes is < nResolutions) then the process is the same as in case 2, except loading starts with the first resolution available, continues with the 2nd resolution, and so on, up to resolution Passes-1, and then loading is completed with the decompression of the last resolution available in the file.
For more information about loading and saving large TIFF files faster, refer to Loading and Saving Large TIFF/BigTIFF Files.
ELO_MULTISPECTRALSCAN is used internally by the NITF filter. You do not need to use this flag.
When loading images for display purposes on platforms that expect image data to be in premultiplied alpha format, include the ELO_PREMULTIPLY_ALPHA flag for proper image display (i.e., the transparency information will be preserved). When loading images for image processing purposes do not include ELO_PREMULTIPLY_ALPHA, so image data will be loaded as it is actually stored in the input file (for proper pixel data manipulation).
See L_GetDefaultLoadFileOption for information on default load options.