Jump to content

Alpha not provided to other apps on clipboard


Recommended Posts

(I'm making a new thread since I inadvertently broke the rules by continuing one from 8 months ago. My apologies. If anyone wants to see my original more detailed post, go here.)

Back in July 2011, the following was written on this forum to someone trying to get an image with transparency out of Paint.NET via the clipboard:

The bitmap data (DIB) that Paint.NET copies should be stored in PBGRA format (premultiplied alpha), even though DIB doesn't allow you to specify anything about how the alpha channel is encoded. You simply need to divide each color component by the alpha value. There will be a loss of precision, but it will give you transparency you need.

However, my own experiments indicate this is not how Paint.NET functions. When copying an image to the clipboard, Paint.NET only puts the real alpha data in its own proprietary clipboard format ("PaintDotNet.MaskedSurface"). All other formats that it provides on the clipboard do not contain real alpha data; only 0xFF (solid / opaque).

As a result, it seems to be impossible to copy and paste an image from Paint.NET into any other piece of software while retaining alpha in the image.

Is this a bug or the intended behavior?

Link to comment
Share on other sites

Thanks for making a new post.

It is both a bug and not a bug. About a year ago I buckled down and spent a whole lot of time trying to perfect this scenario. As it turns out, each Windows application seems to have its own quirks or bugs with how they handle this stuff. So I had to settle on a clipboard "strategy" that produced the least amount of trouble. And that meant not including transparency in the format other apps use, and not including the "PNG" format because it would either 1) use more memory (a big problem on 32-bit/x86) or 2) inconsistently not work (because I wouldn't add it if there wasn't enough memory to do so).

The Paint.NET Blog: https://blog.getpaint.net/

Donations are always appreciated! https://www.getpaint.net/donate.html

forumSig_bmwE60.jpg

Link to comment
Share on other sites

Ok I understand. Thanks for the explanation! I suppose I'll just advise avoiding the clipboard for this sort of thing. Maybe Microsoft will standardize this sufficiently someday, or perhaps more likely, abolish the clipboard altogether. :)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...