Converting Images from One File Format to Another

 

If you have to change the image file format of a file do the following:

  1. Load the image into a DIB (for example TIF)

  2. Save the DIB into the desired image format (for example JPG)

 

You can convert a DIB to Bitmap or a Bitmap to DIB with ConvertDIBToBitmap and ConvertBitmapToDIB. These functions are in the BiDIB DLL and OCX.

 

[C++]

 

/* Convert a DIB to a Bitmap*/

 

#include “BiDIB.h”

 

HBITMAP hBitmap;

 

/* 1. parameter: Handle of the DIB to convert */

 

hBitmap  = ConvertDIBToBitmap(hDib);

if (!hBitmap)

{

            // Error

}

 

[C#]

 

/* Convert a DIB to a Bitmap*/

 

long hBitmap;

 

/* 1. parameter: Handle of the DIB to convert */

 

hBitmap = BiDIB.ConvertDIBToBitmap(hDib);

if (hBitmap == 0)

{

            // Error

}