views:

66

answers:

2

Does anyone know of a way to determine if a image stream is in color or black and white, I have thousands of images to process from sql server stored in a varbinary. Can one read the images header (if type of image is known - bitmaps) from byte offsets directly? IF so how can i do this in sql.

+1  A: 

You can use SUBSTRING (http://msdn.microsoft.com/en-us/library/ms187748.aspx) to get header part of varbinary image then process it yourself depending on the image type. SQL does not know to do that.
Here is the information about the bytes you need to extract:
http://en.wikipedia.org/wiki/BMP_file_format#BMP_File_Header

alemjerus
+1  A: 

this thread may be useful

serhio
nice idea... about the thumbnails
almog.ori