SaveDIBInJPEGFileEx

#include "BIJPEG.H"

int CALLBACK SaveDIBInJPEGFileEx( LPTSTR                      lpFileName,
HANDLE                   hDib,
JCompressInfo FAR* lpInfo)

Description

Saves the device independent bitmap (DIB) in JPEG format using complete compression parameters. The saved file contains ICC embedded profile of sRGB standard color space.

Parameters

LPTSTR

lpFileName

Pointer to the file name string.

HANDLE

hDib

Device independent bitmap.

JCompressInfo FAR

* lpInfo

Far pointer to JCompressInfo structure.

 

typedef struct tagJCompressInfo

{

WORD

wWidth;

Width of image.

WORD

wHeight;

Height of image.

DWORD

dwXRes;

Image X Resolution in Pixel per meter.

DWORD

dwYRes;

Image Y Resolution  in Pixel per meter.

WORD

wQuality;

Image Quality Factor  between 1 - 100.

if quality factor is set to 1,the output file is the largest and the loss ratio is the smallest.

if the quality factor is set to100, the output file is the largest and the loss ratio is the smallest. default value is 75.

WORD

wColors;

Output colors 1 or 3 - fill in the function.

BOOL

bGrayOutput;

If TRUE the compressor convert 24 bit images to grayscale 8 bit output.

WORD

wXSubSampling;

Crominance components horizontal subsampling 1-2.

WORD

wYSubSampling;

Crominance component vertical subsampling 1-2.

WORD

wRestartInterval;

JPEG coder restart interval 0-65535.

WORD

wHeaderType;

JPEG Application Marker type.

JHDR_JFIF - JPEG Interchange file format using YCbCr color model.

JHDR_G3FAX - CCITT T.4E JPEG File format using Lab color model.

INT_PTR

lUserData;

A pointer to a user defined data structure. It is passed to the callback function as a third parameter unchanged.

FILLPROC

lpLineFn;

Callback function which will pass the DIB lines from the compressor.

BOOL

bHPLabColor

Lab marker.

BOOL

bDNL

DNL marker.

} JCompressInfo;

Additional Information

This example shows how to use the dll when loading statically including the header file. Otherwise if the dll is loaded dynamically, for further information read the “About the difference of static and dynamic library loading” section of the manual.

Return values

Returns 0 on success, error code if failed.

Requirements

Header :     Declared in BiJpeg.h; include BiJpeg.h.

Library :    Use BiJpeg.lib.

DLLs :       BiJpeg.dll.

Code example

Save hDIB to G3FAX jpeg file

 

int SaveToG3FAX_JPEG(LPSTR lpFileName,HANDLE hDIB)

{

    JCompressInfo Info ;

 

    Info.wXSubSampling = 1;

    Info.wYSubSampling = 1;

    Info.wQuality = 50;

    Info. bGrayOutput = FALSE;

 

    Info.wHeaderType = JHDR_G3FAX;

    Info.wRestartInterval = 0;

 

    return SaveDIBInJPEGFileEx(lpFileName, hDIB, &Info);

}