-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathImageEncodingChecker.cs
45 lines (35 loc) · 1.3 KB
/
ImageEncodingChecker.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
using System;
class Program
{
public static void Main(string[] args)
{
int size, height, width;
Console.WriteLine("[Image Encoding Checker]");
Console.Write("What is the image width? ");
width = Convert.ToInt32(Console.ReadLine());
Console.Write("What is the image height? ");
height = Convert.ToInt32(Console.ReadLine());
Console.Write("What is the file size (in bytes)? ");
size = Convert.ToInt32(Console.ReadLine());
int totalpixels, totalbytesperpixal, bytesperchannel, bitsperchannel;
totalpixels = width * height;
totalbytesperpixal = size / totalpixels;
bytesperchannel = totalbytesperpixal / 3;
bitsperchannel = bytesperchannel * 8;
switch (bitsperchannel)
{
case 8:
Console.WriteLine("\nThe RGB image is encoded with 8 bits per channel.");
break;
case 16:
Console.WriteLine("\nThe RGB image is encoded with 16 bits per channel.");
break;
case 32:
Console.WriteLine("\nThe RGB image is encoded with 32 bits per channel.");
break;
default:
Console.WriteLine("\nThe information is invalid – please re-enter it.");
break;
}
}
}