L_GetBitmapColorType

#include "l_bitmap.h"

L_LTIMGCOR_API L_INT L_GetBitmapColorType(pBitmap, puType, puConfidence, uFlag)

pBITMAPHANDLE pBitmap;

pointer to the bitmap handle

L_UINT * puType;

pointer to a variable to be updated

L_INT * puConfidence;

pointer to a variable to be updated

L_UINT uFlag;

flags

Gets the color type of the bitmap (black and white, color or grayscale), along with the confidence level.

Parameter Description
pBitmap Pointer to the bitmap handle referencing the bitmap whose color type will be retrieved.
puType Pointer to a variable to be updated with the color type of the bitmap. Possible values are:
  Value Meaning
  BITMAP_COLORTYPE_BLACKANDWHITE [0x00000001] The bitmap is black and white.
  BITMAP_COLORTYPE_GRAYSCALE [0x00000002] The bitmap is grayscale.
  BITMAP_COLORTYPE_COLOR [0x00000003] The bitmap is color.
puConfidence Pointer to a variable to be updated with the level of accuracy. Possible values are range from 50 to 100.
uFlag A flag that is used to make the algorithm favor one type of bitmap over the others. For example, if color bitmaps are expected to be detected, even if they are more grayscale, they can be favored by passing BITMAP_COLORTYPE_FAVOR_COLOR. Possible values are:
  Value Meaning
  BITMAP_COLORTYPE_FAVOR_COLOR [0x00000001] Favor color bitmaps over other types.
  BITMAP_COLORTYPE_FAVOR_BLACKANDWHITE [0x00000002] Favor black and white bitmaps over other types..
  BITMAP_COLORTYPE_FAVOR_GRAYSCALE [0x00000004] Favor grayscale bitmaps over other types.

Returns

SUCCESS

The function was successful.

< 1

An error occurred. Refer to Return Codes.

Comments

This functions works with 1, 2, 3, 4, 5, 6, 7, 8, 12, 16, 24, 32, 48 and 64-bit images.

Required DLLs and Libraries

LTIMGCOR

For a listing of the exact DLLs and Libraries needed, based on the toolkit version, refer to Files To Be Included With Your Application.

Platforms

Win32, x64, Linux.

See Also

Functions:

L_GrayScaleBitmap, L_ColorResBitmap, L_GetBitmapHistogram

Topics:

Raster Image Functions: Image Analysis

 

Color Halftone and Halftone Images

Example

This example gets the type of the image and whether it's black and white, colored or grayscale, along with the confidence level.

L_INT  GetBitmapColorTypeExample(pBITMAPHANDLE pBitmap) 
{ 
   L_INT nRet = 0; 
   L_UINT uType = 0; /* bitmap color type */ 
   L_INT uConfidence = 0; /* confidence */ 
   L_TCHAR szMessage[80]; /* Buffer for the MessageBox string */ 
   nRet = L_GetBitmapColorType(pBitmap, &uType, &uConfidence, BITMAP_COLORTYPE_FAVOR_COLOR); 
   if(nRet != SUCCESS) 
      return nRet; 
   /* Display the result in a message */ 
   switch(uType) 
   { 
      case BITMAP_COLORTYPE_BLACKANDWHITE: 
      wsprintf( szMessage, TEXT("The bitmap is Black and White: %ld"), uConfidence ); 
      break; 
      case BITMAP_COLORTYPE_GRAYSCALE: 
      wsprintf( szMessage, TEXT("The bitmap is Grayscale: %ld"), uConfidence ); 
      break; 
      case BITMAP_COLORTYPE_COLOR: 
      wsprintf( szMessage, TEXT("The bitmap is Color: %ld"), uConfidence ); 
      break; 
   } 
   MessageBox (NULL, szMessage, TEXT("Result"), MB_OK); 
   return SUCCESS; 
} 

Help Version 19.0.2017.10.27
Products | Support | Contact Us | Copyright Notices
© 1991-2017 LEAD Technologies, Inc. All Rights Reserved.
LEADTOOLS Raster Imaging C API Help