LEADTOOLS Support
Imaging
Imaging SDK Questions
How to know if the image is grey or colored (attributes of image)?
This topic and its replies were posted before the current version of LEADTOOLS was released and may no longer be applicable.
#1
Posted
:
Monday, April 28, 2008 4:47:56 AM(UTC)
Groups: Registered
Posts: 4
I am a newbie. I am trying to use lead tools. I have 2 queries.
I am loading an image (jpg or tiff) using following function,
I]
FILEINFO l_FileInfoObj;
l_FileInfoObj.uStructSize = sizeof(FILEINFO);
l_nRet = L_FileInfo ( rFilePath.GetBuffer(255), &l_FileInfoObj, sizeof(FILEINFO), 0, NULL);
rFilePath.ReleaseBuffer();
I get the following attributes Format, Width, Height, BitsPerPixel etc (all the values of FILEINFO).
How can i know the colorspace of the pixels (GREY, RGB or YCBCR)
FILEINFO has last parameter as ColorSpace but it return 1 for both grey and colored images?
II]
How to get Number of bands of data of an image,
for example, 1 (one) for grayscale, 3 for RGB data. I know that all bands contain the same type of data. An image can have from 1 (one) to 4 (D_MAX_BANDS) bands.
I am using Lead Tools version 15.0, Medical express edition.
Any suggestion is welcome
Regards,
Aniruddha
#2
Posted
:
Monday, April 28, 2008 8:56:06 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
The possible values for the ColorSpace property are listed in the documentation which can be found at
http://www.leadtools.com...API/Dlldtyp/FILEINFO.htm
You are correct in that 1 can be returned for both grey and colored images. To find out if an image is grey or colored, check out the Order property in FileInfo.
Could you explain what you mean by bands of data?
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
#3
Posted
:
Tuesday, April 29, 2008 1:55:49 AM(UTC)
Groups: Registered
Posts: 4
Hi Walter,
thanks for the reply but its not helpful :-(
First as stated above the colorspace property is not usefull.
and the Order property in FileInfo doesnt help too. It gives the same value for both color and grey images. I tested this on the test images provided with lead tools software.
Regards,
Aniruddha
#4
Posted
:
Thursday, May 1, 2008 11:53:40 AM(UTC)
Groups: Tech Support
Posts: 366
Thanks: 1 times
Was thanked: 4 time(s) in 4 post(s)
After doing some more digging, it appears that an image has to be either 12- or 16-bits in order for the Order property to come back as ORDER_GRAY. Anything less than 16-bits is palettized and are unordered. I found this in the following help file:
http://www.leadtools.com.../Dllref/L_LoadBitmap.htm
Other than that, it is possible to manually check colors in a palette to determine if an image is in grayscale. This process is somewhat complicated though.
Walter Bates
Senior Support Engineer
LEAD Technologies, Inc.
![LEAD Logo LEAD Logo](https://www.leadtools.com/images/new-site-images/leadtools-logo-header.png)
LEADTOOLS Support
Imaging
Imaging SDK Questions
How to know if the image is grey or colored (attributes of image)?
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.