save image after setting transparency
-
Hello I am loading an image file using gdiplus Bitmap class, and changing the transparency using ColorMatrix, and draw the image in device context, its showing fine in transparency. now i want to save this file in disk (with transparency). is there anyway to do that? i am doing like this. Bitmap gbmp = Bitmap::FromFile("C:\\anyimage.bmp"); ImageAttributes imgAttr; ColorMatrix tcm = { 1.0f, 0.0f, 0.0f, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0.0f, 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 0.6f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; imgAttr.SetColorMatrix(&cm, Gdiplus::ColorMatrixFlagsDefault,Gdiplus::ColorAdjustTypeBitmap); Graphics g(dc.GetSafeHdc()); g.DrawImage(gbmp, Gdiplus::Rect(0, 0, gbmp.GetWidth(), gbmp.GetHeight()), 0, 0, gbmp.GetWidth(), gbmp.GetHeight(),UnitPixel, &imgAttr); after this, i need to save this image in disk. Thanks A. Gopinath.
-
Hello I am loading an image file using gdiplus Bitmap class, and changing the transparency using ColorMatrix, and draw the image in device context, its showing fine in transparency. now i want to save this file in disk (with transparency). is there anyway to do that? i am doing like this. Bitmap gbmp = Bitmap::FromFile("C:\\anyimage.bmp"); ImageAttributes imgAttr; ColorMatrix tcm = { 1.0f, 0.0f, 0.0f, 0, 0, 0.0f, 1.0f, 0.0f, 0, 0, 0.0f, 0.0f, 1.0f, 0, 0, 0.0f, 0.0f, 0.0f, 0.6f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 1.0f }; imgAttr.SetColorMatrix(&cm, Gdiplus::ColorMatrixFlagsDefault,Gdiplus::ColorAdjustTypeBitmap); Graphics g(dc.GetSafeHdc()); g.DrawImage(gbmp, Gdiplus::Rect(0, 0, gbmp.GetWidth(), gbmp.GetHeight()), 0, 0, gbmp.GetWidth(), gbmp.GetHeight(),UnitPixel, &imgAttr); after this, i need to save this image in disk. Thanks A. Gopinath.
-