24 bit bitmap doubt ..
-
Hi i am trying to check whether the bitmap file is 24 bit or not. For this i have written a below code
FileStream File byte[] buffer = new byte[2]; File.Seek(28,0); File.Read(buffer,0,2); Int16 nBit = BitConverter.ToInt16(buffer, 0);
The above code works fine and give me the value of nBit as 24. But i don't understand the exact working of it. Ok first it creates 2byte array, then i have a doubt over 2nd line i.e. File.Read(28,0); Why current position is set to 28 here....?? It gives correct value when i set that to 28 and by next line the position jumps 2 place further i.e. 30 and by then i get correct value 24. Can any one please explain me this behaviour...? Thanks -
Hi i am trying to check whether the bitmap file is 24 bit or not. For this i have written a below code
FileStream File byte[] buffer = new byte[2]; File.Seek(28,0); File.Read(buffer,0,2); Int16 nBit = BitConverter.ToInt16(buffer, 0);
The above code works fine and give me the value of nBit as 24. But i don't understand the exact working of it. Ok first it creates 2byte array, then i have a doubt over 2nd line i.e. File.Read(28,0); Why current position is set to 28 here....?? It gives correct value when i set that to 28 and by next line the position jumps 2 place further i.e. 30 and by then i get correct value 24. Can any one please explain me this behaviour...? ThanksSee The .bmp file format[^]. Note that this lists the fields starting from byte position 1, while the .NET Framework starts counting at 0.
Stability. What an interesting concept. -- Chris Maunder
-
Hi i am trying to check whether the bitmap file is 24 bit or not. For this i have written a below code
FileStream File byte[] buffer = new byte[2]; File.Seek(28,0); File.Read(buffer,0,2); Int16 nBit = BitConverter.ToInt16(buffer, 0);
The above code works fine and give me the value of nBit as 24. But i don't understand the exact working of it. Ok first it creates 2byte array, then i have a doubt over 2nd line i.e. File.Read(28,0); Why current position is set to 28 here....?? It gives correct value when i set that to 28 and by next line the position jumps 2 place further i.e. 30 and by then i get correct value 24. Can any one please explain me this behaviour...? ThanksHi, 28 is an offset in bitmap file which store information about number of bits per pixel. For additional information about bitmaps format you can see Bitmap Image article.
-
Hi, 28 is an offset in bitmap file which store information about number of bits per pixel. For additional information about bitmaps format you can see Bitmap Image article.
okay thanks... So 54 is the header size in bitmap file...