Jump to content

Possible bug: "The clipboard doesn't contain an image."


Toli
 Share

Recommended Posts

If it's not working in Paint.NET or MSPaint, but it works in Word and Excel, you might have some Office proprietary data in the clipboard, not a regular bitmap image.

Or maybe you copied the image file instead of the image. This is not the same thing.

xZYt6wl.png

ambigram signature by Kemaru

[i write plugins and stuff]

If you like a post, upvote it!

Link to comment
Share on other sites

It is not the file, it is a png image. I know the difference.

I copy it using .net.

Clipboard.SetData("PNG", image);

image is a standard 32bpp png which opens fine in Paint.NET and renders fine in .net Windows.Forms.

Clipboard.SetImage(image);

does the job, but the image loses its transparency when pasted, so it's of no use.

So, why does Paint.NET not recognize the "PNG" Clipboard format?

Link to comment
Share on other sites

How wierd. I used the usual right click on the post number. Odd.

I meant to link to Rick's post in this thread: Clicky

Link to comment
Share on other sites

Actually Paint.NET is intentionally lying to you. I needed a way to get more people to sign up for the forum so I made it randomly bomb out on copy/paste ...

Just kidding. It's not lying to you. Like I said elsewhere, the clipboard is a shared resource, it's cantankerous, and it's not very smart. Setting the type to "PNG" doesn't mean anything, you're using the wrong tag there.

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

  • 9 months later...

It is not the file, it is a png image. I know the difference.

I copy it using .net.

Clipboard.SetData("PNG", image);

image is a standard 32bpp png which opens fine in Paint.NET and renders fine in .net Windows.Forms.

Clipboard.SetImage(image);

does the job, but the image loses its transparency when pasted, so it's of no use.

So, why does Paint.NET not recognize the "PNG" Clipboard format?

To properly paste a PNG image to the clipboard, do the following

using (MemoryStream stream = new MemoryStream())

{

_Bitmap.Save(stream, ImageFormat.Png);

var data = new DataObject("PNG", stream);

Clipboard.Clear();

Clipboard.SetDataObject(data, true);

}

This should take care of your problems.

Edited by gregdosborne
Link to comment
Share on other sites

gregdosborne, newer versions of Paint.NET already do this. Using Reflector, look at PaintDotNet.exe, in the PaintDotNet.ClipboardUtil class, in the GetClipboardImageAsSurface() method.

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

I kinda feel like a noob saying something that doesn't involve arguing with strings of code, but when I get an error message like that and I can only paste into a word processor, it is usually because I highlighted the image, then copied it. From a non-programmer perspective (and I feel silly saying this), the computer thinks I copied a piece of text and I'm trying to paste it as an image. To solve the problem, I go back, un-highlight the image, and copy by right clicking and pressing the "copy image" button. Not sure if this is the same issue, but it sure sounds like it is.

 

what I do all summer Emote Cursor Pack 'noob gallery

No, Paint.NET is not spyware...but, installing it is an IQ test. ~BoltBait

Blend modes are like the filling in your sandwich. It's the filling that can change your experience of the sandwich. ~Ego Eram Reputo

Link to comment
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...