Loading a Bitmap from a File

Use the following method to load a file into a bitmap. In most cases, this method is all you need to load a file. Other methods and properties listed in this topic are for optional features and special cases.

Load method

To load an image from a file and resize it as it is being loaded to the desired width, height and bits per pixel, use the following method:

LoadResize method

To load an image from a specific location within a file, use the following method:

LoadOffset method

To load a file asynchronously from an Internet URL or local pathname, refer to Implementing Internet Features.

LEADTOOLS supports loading TIFF CMYK files without converting the data to BGR. This is done by loading each CMYK plane as a separate LEADTOOLS bitmap using the LoadFileCMYKArray method. For more information, refer to Handling CMYK Files as Separate Bitmaps.

When loading CMYK or CIELab files, you can use the fast color conversions, by calling the UseFastConversion property.

Use the following properties and event to control loading an image through an OLE drag-and-drop operation:

OLEDropAllowed property

OLEDropFile event

Use the following method to load a thumbnail (stamp image) into a bitmap from a JFIF or LEAD CMP file:

LoadStamp method

Use the following method to get information about a file before loading it:

GetFileInfo method

Then, read the following properties, which the method updates:

InfoBits property

InfoCompress property

InfoFormat property

InfoHasAlpha property

InfoHeight property

InfoLayers property

InfoPage property

InfoPCDRes property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoViewPerspective property

InfoWidth property

InfoXRes property

InfoYRes property

Use the following property to let the user see the progress when loading a bitmap:

PaintWhileLoad property

Bitmap data can be signed or unsigned. If the bitmap data is signed, the image processing and paint methods may not work correctly. A bitmap will not be loaded signed unless the LoadSigned property is set to TRUE before loading the image. For more information on this, refer to Examining and Altering Bitmaps.

Use the following property to specify the number of paint-while-load passes when the file is a progressive LEAD or JPEG file, or when it is an interlaced PNG file:

ProgressivePasses property

Use the following property to specify which of the available resolutions in a PCD file to load:

PCDRes property

The WMFResolution property sets the DPI (dots per inch) value that LEADTOOLS uses when loading WMF files.

When loading DJVU files, you can use the DJVResolution property to get or set the current display resolution used by LEADTOOLS when loading a DJVU file. The default value for this property is 96 DPI.

When loading PTOCA and AFP:PTOCA files, you can use the PTKResolution property to get or set the current display resolution used by LEADTOOLS.

When loading RTF files, you can use the RTFTopMarg, RTFBottomMarg, RTFRightMarg, RTFLeftMarg, RTFPaperWidth, and RTFPaperHeight properties to get or set the current value for the control options used by LEADTOOLS.

When loading HPGL files, you can use the PLTPenColor property and the PLTPenWidth property to get or set the current value for the control options used by LEADTOOLS.

For PCD and FlashPix files, additional methods and properties are described in Implementing PhotoCD and FlashPix Features.

Use the following property to let a bitmap with a rotated view perspective keep its internal orientation when it is loaded.

LoadUseViewPerspective property

Use the following property to indicate whether to load images compressed or uncompressed:

LoadCompressed property

Use the following properties, if necessary, to supply format information about the image data that is being loaded. You can use this feature for loading input data (such as raw fax) that LEADTOOLS cannot recognize. When loading an image from a file, LEADTOOLS normally determines the file format from the file header, and if the format is unrecognized, the function returns an error. The LoadInfo event occurs before the error, if the EnableLoadInfoEvent property has been set to true. (If the EnableLoadInfoEvent property is set to false, this event is not generated.) You can set these properties in that event (or anywhere else in your program) to supply the missing format information and prevent the error. (LEADTOOLS checks for a non-zero value in the LoadInfoFormat property, but to implement this feature, you need to set all of the properties to appropriate values.)

LoadInfoBits property

LoadInfoFlags property

LoadInfoFormat property

LoadInfoHeight property

LoadInfoOffset property

LoadInfoWidth property

LoadInfoXRes property

LoadInfoYRes property

ColorSpace property

IgnoreViewPerspective property

To set the file format to try first when recognizing files for loading, set the PreferredLoadFormat property.

Please note that the Document/Medical editions also support the loading and saving of Mixed Raster Content (MRC) files. The Mixed Raster Content format was defined for use for color and grayscale fax as part of the RFC-2301, File Format for Internet Fax. The Mixed Raster Content mode (T.44) enables different coding methods and resolutions to be used within a single page by defining a 3-layer image model for structuring and combining the scanned image data.

LEADTOOLS will attempt to load corrupted files, so you can see at least a portion of the image. For these images, the load functions will return SUCCESS, but the LoadStatus property will be updated with an error code.

When loading TXT files, you can use the following properties to get or change the current values for the control options used by LEADTOOLS:

TXTBold property

TXTBottomMarg property

TXTEnabled property

TXTFaceName property

TXTFontColor property

TXTFontSize property

TXTHighlight property

TXTItalic property

TXTLeftMarg property

TXTPaperHeight property

TXTPaperWidth property

TXTRightMarg property

TXTStrikeThrough property

TXTTopMarg property

TXTUnderLine property

To use the fast loading algorithm while loading LEAD ABC files, use the FastLoad property. The fast loading algorithm provides faster loading with less image details.