Im working on app for my educational purposes.
I want to make any image (jpg, png) from 24/32bpp to 8bpp, because i only want values from 0 to 255 in one scale (in this situation, gryascale) and i dont need to have RGB or RGBA color space.
I found a solution for it, can i use Graphics.DrawImage
for making a copy of my input image, but with cutting not needed channels? Of course, after binarize the image.
//binarization first
static public Bitmap CreateNonIndexedImage(Bitmap bitmap)
{
Bitmap newBmp = new Bitmap(bitmap.Width, bitmap.Height, PixelFormat.Format32bppArgb); // i want to change pixel format here
using (Graphics graphics = Graphics.FromImage(newBmp))
{
graphics.DrawImage(bitmap, 0, 0); //if it make an exact copy of input bitmap?
}
return newBmp;
}
Thanks for any advices