473,386 Members | 1,621 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Bitmap sent to clipboard showing up as 32bpp DIB not 24bpp DIB?

[ also posted to microsoft.public.dotnet.csharp.general, not sure which
is the correct ng for this type of question ]

Hello,

I have an application which requires an image to be retrived from the
clipboard. So, I am writting a quick C# windows application to take
images from a webcam and store a single frame on the clipboard so it can
be pasted into this other application. My solution is working fine with
all applications (mspaint, word, wordpad) except the one I need it to
work with. I've contacted the vendor of the application, but I haven't
been able to get anywhere with them.

I think I've narrowed down my problem to the format of the DIB being
placed on the clipboard. When I call Clipboard.setDataObject(someBitmap)
the DIB which is placed into the clipboard has a type of 32bpp BITFIELDS
and not 24bpp RGB. Even though I specifically set the PixelFormat to
Format24bppRgb when the Bitmap object is created. When I attempt to
paste the image in the target application, nothing happens. If I first
paste the image to mspaint, then select all, copy it to the clipboard
again and then paste it into the application it works fine. When mspaint
places the image on the clipboard it is a 24bpp RGB image, and not a
32bpp BITFIELDS image. I've been using the clipboard viewer application
at
(http://www.codeguru.com/cpp/w-p/clip...cle.php/c9155/)
to see the data placed on the clipboard.

Anyone have any idea how I can take a C# Bitmap object and turn it into
a 24bit RGB image which will appear on the clipboard? I've been trying
to figure this out for hours!

The following code demonstrates the issue :

Bitmap b = new
Bitmap(100,100,System.Drawing.Imaging.PixelFormat. Format24bppRgb);
for (int i=0;i<50;i++)
{
b.SetPixel(i,i,Color.Red);
}
Clipboard.SetDataObject(b);

After this the CF_DIB stored on the clipboard will be 32bpp and
BITFIELDS not RGB. I am not certain what BITFIELDS means, it is what is
displayed by the clipboard viewer I am using..
Thanks!

-James
May 3 '06 #1
0 1882

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

8
by: James Dean | last post by:
I have 1 bit per pixel information and i have the width and height of this data.Each bit corresponds to a 24 bit colour value. I want to convert this to 24bit per pixel bitmap. Do i need to...
2
by: James Dean | last post by:
I create a bitmap like this. The width and height are got from the compressed file i am reading. The width and height are in pixels.....1bpp bitmap = new...
2
by: James Dean | last post by:
I can display an 8bpp indexed bitmap correctly but when i tried to convert this to 32ARGB then it didn't display properly at all. I am just wondering how i can display the same 24bpp image at the...
0
by: news.microsoft.com | last post by:
Hi guys, This text looks long and complicate but it is not, and I really really need some help here. For the last 24hs I'm trying to resolve this issue (last night I dreamed
0
by: Duracel | last post by:
Hi, I've got a routine that fetches a bitmap from a COM server and converts it into a .NET format bitmap. The original DIB surface is 24 bit. When blitting this bitmap to a window, the speed...
12
by: active | last post by:
I've been looking on the Internet for a way to convert a DIB to a Bitmap without success. Now I'm wondering if that is the approach I should be taking. All I want to do is display the DIB or...
6
by: \Frank\ | last post by:
I trying to learn what a Bitmap is. Not a Managed Bitmap Object but one that, for example, comes from the clipboard with CF_BITMAP. I'm guessing that a CompatableBitmap is an array of indices...
6
by: ProtossLee | last post by:
Hi, I am currently working on a project for image processing. a double matrix m1(1300X1000) need to be converted into bitmap and displayed on screen. so far I've made the following code: For i...
20
by: Joe Duchtel | last post by:
Hello - I have the following code to get a bitmap from the clipboard and to save it to a *.png file ... Dim lData As IDataObject = Clipboard.GetDataObject() If...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.