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 a file asynchronously from an Internet URL or local pathname, refer to Implementing Internet Features.

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

OLEDropAllowed property

OLEDropAutoLoad 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

InfoXRes property

InfoYRes property

InfoPage property

InfoPCDRes property

InfoSizeDisk property

InfoSizeMem property

InfoTotalPages property

InfoViewPerspective property

InfoWidth property

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

PaintWhileLoad property

When loading multi-page files, the FilePageLoaded event is fired for each page loaded, only if the EnableFilePageLoadedEvent property has been set to TRUE. The FilePageLoaded event can be used to store or get information about individual pages of the multi-page file.

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

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 indicates whether to load 1-bit images 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, and 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

 

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