[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.drawing

Saving BMP as PixelFormat.Format24bppRgb is saved in 32 bit format

robert linder

11/17/2004 10:33:00 PM

I am trying to save an image from clipboard.
IDataObject viewer shows 'CF_BITMAP' format .

Here is the code I am using to saving the clipboard to a 24bppRgb .bmp file.
------------
Bitmap bt =
(Bitmap)System.Windows.Forms.Clipboard.GetDataObject().GetData(DataFormats.Bitmap);
Rectangle lockedRect = new Rectangle( 0,0,bt.Width,bt.Height);
BitmapData bmpData = bt.LockBits( lockedRect, ImageLockMode.ReadWrite ,
PixelFormat.Format24bppRgb);
bmpData.PixelFormat = PixelFormat.Format24bppRgb;

bt.UnlockBits(bmpData);
bt.Save( "tmp.bmp", ImageFormat.Bmp );
------------
Using a file manager , property viewer on the image file, it shows as 32
bit depth color.
------------

I need to have the bmp as 24 bits since the file is begin used by a
program that is not under my control.