Jump to content

Unable to Paste from Firefox


Recommended Posts

Okay so before I get told I checked the pinned post regarding 'out of memory' errors.

 

I've been getting 'Not Enough Memory to Paste from Clipboard' quite a lot recently.

As of this moment I am trying to copy a 443x312 jpg and paste into paint.net.
I am using ~35% of my total 16GB RAM. I have over 10GB of free drive space on C:

I'm running Win10 64-bit.

 

Why is this happening?

 

=======

Error log:

=======

System.OutOfMemoryException: Out of memory.

   at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)

   at PaintDotNet.ClipboardUtil.GetClipboardImageAsSurface(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 352

   at PaintDotNet.ClipboardUtil.GetClipboardImageImpl(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 215

   at PaintDotNet.ClipboardUtil.GetClipboardImage(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 164

   at PaintDotNet.Actions.PasteAction.PerformActionImpl() in D:\src\pdn\src\PaintDotNet\Actions\PasteAction.cs:line 110

Link to comment
Share on other sites

I just got the error trying to Paste into New Image an image from the Average Object Color thread.

 

The image:

FlowerOrig_zpswwo19u0h.png

 

The error message:

System.OutOfMemoryException: Out of memory.
   at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)
   at PaintDotNet.ClipboardUtil.GetClipboardImageAsSurface(IWin32Window currentWindow, IPdnDataObject clipData)in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 352
   at PaintDotNet.ClipboardUtil.GetClipboardImageImpl(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 215
   at PaintDotNet.ClipboardUtil.GetClipboardImage(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 164
   at PaintDotNet.Actions.PasteInToNewImageAction.PerformAction(AppWorkspace appWorkspace) in D:\src\pdn\src\PaintDotNet\Actions\PasteInToNewImageAction.cs:line 46

According to the Task Manager, I have about 3 GB of free memory.

 

Link to comment
Share on other sites

Pdn 4.0.13
Just copied MJW's sunflower image (latest firefox/right click/ copy image) - opened Pdn with a view to creating a new image and pasting.
Didn't get that far as Pdn locked up. Cursor still moved but no controls worked - including minimize and close. Closed it using task manager.
No 'program not responding message'. No error message, No crash report, just 'froze'?

 

Tried a second time and I get the same out of memory error message as above.

 

All these crash reports mention 'useEmbeddedColorManagement' but I thought Pdn didn't use that anyway?

 

Solved (for me)

Disabled the Pinterest Firefox plugin.

 

Red ochre Plugin pack.............. Diabolical Drawings ................Real Paintings

 

PdnForumSig2.jpg

Link to comment
Share on other sites

5 hours ago, Red ochre said:

Just copied MJW's sunflower image (latest firefox/right click/ copy image)

 

I got as far as trying to paste the image...

 

Spoiler

System.OutOfMemoryException: Out of memory.

   at System.Drawing.Image.FromFile(String filename, Boolean useEmbeddedColorManagement)

   at PaintDotNet.ClipboardUtil.GetClipboardImageAsSurface(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 352

   at PaintDotNet.ClipboardUtil.GetClipboardImageImpl(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 215

   at PaintDotNet.ClipboardUtil.GetClipboardImage(IWin32Window currentWindow, IPdnDataObject clipData) in D:\src\pdn\src\PaintDotNet\ClipboardUtil.cs:line 164

   at PaintDotNet.Actions.PasteAction.PerformActionImpl() in D:\src\pdn\src\PaintDotNet\Actions\PasteAction.cs:line 110

 

Link to comment
Share on other sites

As toe_head2001 stated earlier in this thread:

On 2/13/2017 at 2:42 AM, toe_head2001 said:

A few other people have reported the same issue. It's not actually a memory issue, but rather an issue with the image format.

 

The Image.FromFile method throws an OutOfMemoryException when it does not support loading the image.

From MSDN:

Quote

If the file does not have a valid image format or if GDI+ does not support the pixel format of the file, this method throws an OutOfMemoryException exception.

 

PdnSig.png

Plugin Pack | PSFilterPdn | Content Aware Fill | G'MICPaint Shop Pro Filetype | RAW Filetype | WebP Filetype

The small increase in performance you get coding in C++ over C# is hardly enough to offset the headache of coding in the C++ language. ~BoltBait

 

Link to comment
Share on other sites

I looked into the issues this morning.

 

TL;DR: Firefox's fault. It's saving HTML as a PNG image. Ok, I guess it's PhotoBucket's fault too, because they are redirecting requests to the PNG image to an HTML page.

 

 

While Firefox places several formats on the clipboard (including valid Bitmaps/DIBs), paint.net ends up trying to load an invalid PNG image. Too bad the image is actually HTML code saved as a PNG.

 

 

 

Here's the PNG file on the clipboard:

png-clipboard.png

 

And here's the content of the "PNG" file:

png-contents.png

 

 

Chromium based browsers (Chrome, Vivaldi, ect.) don't place so many formats on the clipboard, so paint.net ends up loading the Bitmap/DIB, thus avoiding the issue of PhotoBucket redirecting requests to PNG images.

Edited by toe_head2001
fixed broken images
  • Upvote 1

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

Microsoft Paint seems to have no problem pasting the images that PDN gives the memory error on. I copied my flower image to the clipboard and tried pasting into PDN. I got the "not enough memory" error. I then went to an open MS Paint window and clicked the Paste button. The image was immediately pasted. I tried with a different image, with the same result. If there's a problem with the image data in the clipboard, it's a problem MS Paint can deal with.

Link to comment
Share on other sites

One thing I just realized is that I can use the problematic clipboard images in plugins that use the clipboard, such as the Texture Shader and Texture Merger. So, if PDN can identify it's supposed to be a PNG image, and if PDN can access the data, isn't it better to fix it to work, even if it's technically Firefox's problem?

Link to comment
Share on other sites

2 hours ago, MJW said:

So, if PDN can identify it's supposed to be a PNG image, and if PDN can access the data, isn't it better to fix it to work, even if it's technically Firefox's problem?

Personally, yes, I think a workaround would be ideal.

In my previous post, I should have said something more like: "It's an issue in Firefox that exposes a limitation of paint.net".

 

Paint.net is just weird about selecting a format from the clipboard. I've brought this up before:

http://forums.getpaint.net/index.php?/topic/31799-selecting-a-format-from-the-clipboard/

(September 25th, 2023)  Sorry about any broken images in my posts. I am aware of the issue.

bp-sig.png
My Gallery  |  My Plugin Pack

Layman's Guide to CodeLab

Link to comment
Share on other sites

10 hours ago, BoltBait said:

Rick is unlikely to change his clipboard handling code.

 

Any changes made would mean trade-offs that he's unwilling to make.

 

Nevertheless, it's worth investigating.

 

If this can be reproduced easily and consistently, I can look into it and hopefully find understanding on this issue.

 

So if someone has a list of dummy-proof and very specific instructions to recreate this, I can check it out. This is really important so that I can recreate the problem and verify the fix (assuming there is one).

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

1 hour ago, Rick Brewster said:

So if someone has a list of dummy-proof and very specific instructions to recreate this, I can check it out. This is really important so that I can recreate the problem and verify the fix (assuming there is one).

 

There's an image of flowers (from my PaintBucket account)  in my comment above. If you use Copy Image to copy the image, then try to import it into PDN using Paste into New Image, you should see the "Not enough memory" error.

Link to comment
Share on other sites

Okay I should have a fix for this in the next update, even if Firefox doesn't fix anything on their side.

 

Paint.NET has a prioritized list of formats that it goes through. If data isn't available in format 1, it will then try format 2, then format 3, etc. However, if any format throws an OutOfMemoryException, the whole process stops and is aborted.

 

The fix is that an OOME won't cause an abort. The format will be retried once after a full garbage collection is forced, and then if it still won't work then the next format will be tried.

 

And it works great with whatever Firefox is doing.

  • Upvote 4

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

  • 1 month later...
  • toe_head2001 changed the title to Unable to Paste from Firefox

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.

×
×
  • Create New...