GDI+ Problemo
-
Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code :
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb);
where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool: -
Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code :
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb);
where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool:Try 8bitIndexed pixel format xacc-ide 0.0.15 now with C#, MSIL, C, XML, ASP.NET, Nemerle, MyXaml and HLSL coloring - Screenshots
-
Hi guyz. I am trying to lock the bits of a gif image which is 32-bit. However, I am getting an invalid parameter on this code :
BitmapData bmData = b.LockBits(new Rectangle(0, 0, b.Width, b.Height), ImageLockMode.ReadWrite, PixelFormat.Format32BppArgb);
where b is the bitmap variable in which I load the image in! Can any body help out on this? because I really have no idea now...since in 24-bit withPixelFormat24BppRgb(bmp + jpg) worked correctly! :confused: To Dare Is To Do :cool:Hello Why do you think your GIF image is 32-bit ? You can check the
PixelFormat
property and you will see, that it'sFormat8bppIndexed
. You can try to useImageLockMode.ReadOnly
mode or lock your image with PixelFormat.Format8bppIndexed or convert your image to 32-bit before (which will be useful if you are planning some image processing routines). With best regards, Andrew -
Hello Why do you think your GIF image is 32-bit ? You can check the
PixelFormat
property and you will see, that it'sFormat8bppIndexed
. You can try to useImageLockMode.ReadOnly
mode or lock your image with PixelFormat.Format8bppIndexed or convert your image to 32-bit before (which will be useful if you are planning some image processing routines). With best regards, Andrew -
Yep that's actually what I'm trying to do! To convert to 32-bit from 8 bit index....how?? bcos I really do not know! Thanks guys To Dare Is To Do
Hello. You can use the next 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();
With best regards, Andrew