I have an assignment and I want to convert an RGB Image to Greyscale 8-bit and 16-bit. I got this formula from google but it doesn't whether that is 8-bit or 16-bit. Can someone explain the difference between 8-bit Greyscale and 16-bit Greyscale?
int i, j;
if (File != null)
{
File2 = new Bitmap(File);
for (i = 0; i <= File2.Width - 1; i++)
{
for (j = 0; j <= File2.Height - 1; j++)
{
Color originalColor = File2.GetPixel(i, j);
int grayScale = (int)((originalColor.R * .3) + (originalColor.G * .59) + (originalColor.B * .11));
Color newColor = Color.FromArgb(grayScale, grayScale, grayScale);
File2.SetPixel(i, j, newColor);
}
}
hasilBox.Width = File2.Width;
hasilBox.Height = File2.Height;
hasilBox.Image = File2;
}