4
Answers

find resolution of image from array of bytes

Photo of zozo ahmed

zozo ahmed

11y
2k
1

Array of eight bytes , i want to convert this first four bytes into 32-bit fixed point

number containing the horizontal resolution of image in pixels per inch , and the second four

bytes into 32-bit fixed point number containing the vertical resolution of image in pixels

per inch,how can i do that??

   byte []a=new byte[8] {0,72,0,0,0,72,0,0}  // array of bytes
C#

it must find resolution of image in pixel by using this four bytes {0,72,0,0},use c#

language.

Answers (4)

0
Photo of zozo ahmed
NA 18 16.6k 11y
yes,i am sure
0
Photo of Vulpes
NA 96k 2.6m 11y
Not to my knowledge.

Are you sure that the units are pixels per inch?

0
Photo of zozo ahmed
NA 18 16.6k 11y
is resolution 18432*18432 ,a correct resolution ?
0
Photo of Vulpes
NA 96k 2.6m 11y
Well, on the face of it, this code should do it:

      byte[] a = new byte[8] {0,72,0,0,0,72,0,0}; 
      int horizontal = BitConverter.ToInt32(a, 0);
      int vertical = BitConverter.ToInt32(a, 4);
      Console.WriteLine("Resolution: {0} x {1}", horizontal, vertical);

but the output seems far too high:

      Resolution: 18432 x 18432