changing image format
-
Hi there I've encountered a small problemo...... I'm trying to change brightness of an image...so far so good. However I managed to make it work on 24-bit format images. When the filter is fed with an image which is either
8bit indexed or 32-bit formats
...it fails! ...is there any way to access 8-bit indexed images with C# pointers! I was observing this message board and found out the following code:// create new image with desired pixel format Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); // draw source image on the new one using Graphics Graphics g = Graphics.FromImage(bmp); g.DrawImage(src, 0, 0, width, height); g.Dispose();
...Many thanks to Andy Kirillov Does the above code...'store' my image as a 24 bit image? The code project....a perfect experience :cool: -- modified at 8:39 Saturday 22nd October, 2005 -
Hi there I've encountered a small problemo...... I'm trying to change brightness of an image...so far so good. However I managed to make it work on 24-bit format images. When the filter is fed with an image which is either
8bit indexed or 32-bit formats
...it fails! ...is there any way to access 8-bit indexed images with C# pointers! I was observing this message board and found out the following code:// create new image with desired pixel format Bitmap bmp = new Bitmap(width, height, PixelFormat.Format32bppArgb); // draw source image on the new one using Graphics Graphics g = Graphics.FromImage(bmp); g.DrawImage(src, 0, 0, width, height); g.Dispose();
...Many thanks to Andy Kirillov Does the above code...'store' my image as a 24 bit image? The code project....a perfect experience :cool: -- modified at 8:39 Saturday 22nd October, 2005Hello Yes, you can use the above code to convert your image to 24bpp or 32bpp format (as you already know,
Image.Clone
does not produce this functionality, as it was expected). With 24bpp image you can use most of image processing filters.XeoN-Kc wrote:
I was observing this message board and found out the following code:
Yes, there is. Use
LockBits
. But, you will get troubles if you have color indexed image (like GIF). As you can see from my first article, I am using 24bpp format for color images, 8bpp indexed for grayscale images. Both formats I am processing usingLockBits
. And in the case of grayscale image it's rather obvious to implement brightness filter (the same logic as for 24bpp).XeoN-Kc wrote:
...Many thanks to Andy Kirillov
Oh, what is it ? :~ Who changed my name ? :mad: With best regards, Andrew Kirillov, MCP x 3 Prize winner, August 2005