evanpage

Not Enough Memory to Paste from Clipboard

31 posts in this topic

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

0

Share this post


Link to post
Share on other sites

UPDATE: This issue is usually caused by a bug in Firefox. Here's the bug report for those interested in following any progress they make.

https://bugzilla.mozilla.org/show_bug.cgi?id=1340039

 

_____________________________________________

 

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

 

We need to identify the common thread here.

Are you copying an image from a web browser? Which browser? Which version of the browser?

What format (png, jpeg, base64, bmp, ect.) is the image you're copying?

 

Please also post the Diagnostics information from paint.net.

Settings -> Diagnostics -> Copy to clipboard

SettingsDiagnostics.png

0

Share this post


Link to post
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.

 

0

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

I too have only recently started having this issue. It's not consistent with anything that I can see, except for copying an image from the browser (Firefox). I don't have a Pinterest plugin so I don't know what to try to fix this issue. This is only a recent issue. Today I have had this issue 4 times with different sized images ranging from 40x40 avatars to larger layered images.

 

I would appreciate some help on this as it's becoming very frustrating. Interestingly I just tried to drag and drop from the browser to PDN and it worked fine and opened the image no worries. Right-click to copy the image is where it failed to me.

 

Application    paint.net 4.0.13 (Final 4.13.6191.1824)
Build Date    Tuesday, 13 December 2016
    
Hardware accelerated rendering (GPU)    True
Animations    True
DPI    96.00 (1.00x scale)
Language    en-US
    
OS    Windows 10 (10.0.14393.0)
.NET Runtime    4.0.30319.42000
Physical Memory    12,247 MB
    
CPU    Intel(R) Core(TM) i7 CPU         860  @ 2.80GHz
    Architecture    x64 (64-bit)
    Process Mode    64-bit
    Speed    ~2793 MHz
    Cores / Threads    4 / 8
    Features    DEP, SSE, SSE2, SSE3, SSSE3, SSE4_1, SSE4_2
    
Video Card    NVIDIA GeForce 310
    Dedicated Video RAM    459 MB
    Dedicated System RAM    0 MB
    Shared System RAM    3,583 MB
    Vendor ID    0x10DE
    Device ID    0x0A66
    Subsystem ID    0x90601B0A
    Revision    162
    LUID    0x0000D958
    Flags    None
    Outputs    2
    
Video Card    Microsoft Basic Render Driver
    Dedicated Video RAM    0 MB
    Dedicated System RAM    0 MB
    Shared System RAM    6,123 MB
    Vendor ID    0x1414
    Device ID    0x008C
    Subsystem ID    0x00000000
    Revision    0
    LUID    0x0000E108
    Flags    Software
    Outputs    0

 

Edited by Adsy
Additional information
0

Share this post


Link to post
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

 

0

Share this post


Link to post
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.

 

0

Share this post


Link to post
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.

1

Share this post


Link to post
Share on other sites
5 minutes ago, toe_head2001 said:

I looked into the issues this morning.

 

TL;DR: Firefox's fault....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.

 

Just tried out with my Firefox 51.0.1 64bit. No problem, no error message.

0

Share this post


Link to post
Share on other sites
10 minutes ago, IRON67 said:

Just tried out with my Firefox 51.0.1 64bit. No problem, no error message.

 

I guess I dreamed up the whole thing then.

 

Joking aside, I really don't get what you're trying to say. Please articulate your point.

Are you saying Firefox does not place the invalid PNG file on your clipboard when you copy MJW's flower image? What is on your clipboard?

 

0

Share this post


Link to post
Share on other sites
27 minutes ago, toe_head2001 said:

Are you saying Firefox does not place the invalid PNG file on your clipboard when you copy MJW's flower image? What is on your clipboard?

 

If you ask ME: MY Firefox place the right PNG image in my clipboard.

 

clipb.png

 

Maybe your (and other Firefox browsers) are broken by some Addons. That's very often the problem. BTW: In my Firefox working around 30 Addons without problems.

 

Spoiler

Adblock Plus 2.8.2
Application Update Service Helper 1.0
BBCodeXtra 0.5.4
Classic Theme Restorer 1.6.1
Context Search X 0.4.6.26
CookieKeeper 1.9.3.1
Diagnostics 1.0
Disable clipboard manipulations 1.0.1.1-signed
DownThemAll! 3.0.8
DownThemAll! AntiContainer 1.5
Element Hiding Helper für Adblock Plus 1.3.10
FireFTP 2.0.31
Flagfox 5.1.19
Google search link fix 1.6.3
Link Gopher 1.3.3.1-signed.1-signed
Linky 3.0.0.1-signed.1-let-fixed.1-signed
MEGA 3.7.34
Mozilla Archive Format 4.0.2
Multi-process staged rollout 1.7
New Tab Override (browser.newtab.url replacement) 6.0.1
Nightly Tester Tools 3.9
NoScript 2.9.5.3
Personas Plus 1.8.2
Pocket 1.0.5
PrefBar 7.1.0
Private Tab 0.2.1.1
S3.Google Translator 5.26
Saved Password Editor 2.10.3
Screengrab (fix version) 0.99.07c
Send HSTS Priming Requests 1.0
SmoothWheel (AMO) 0.45.8.20130519.3.1-signed.1-signed
Tab Mix Plus 0.5.0.2
Theme Font & Size Changer 50.3
TheRealURL 0.6.1-signed.1-signed
TrashMail.com 2.7.3
Video DownloadHelper 6.2.0
Web Compat 1.0
WorldIP 3.0.9.1-signed.1-let-fixed.1-signed

 

Edited by IRON67
0

Share this post


Link to post
Share on other sites
25 minutes ago, IRON67 said:

Maybe your (and other Firefox browsers) are broken by some Addons.

Come on man, give me more credit than that! :)  Of course I used a new Firefox profile for testing this.

 

Just a follow up question. Are copying the image directly from this page, or are you navigating Firefox to the image, and then copying it?

0

Share this post


Link to post
Share on other sites
25 minutes ago, toe_head2001 said:

Are copying the image directly from this page, or are you navigating Firefox to the image, and then copying it?

 

Rightclick → "Grafik kopieren" (Copy image).

 

Quote

Of course I used a new Firefox profile for testing this.

 

Maybe that's the problem. I have an addon called "Disable clipboard manipulations". Maybe it prevents me from this behaviour. I haven't tested it out.

 

Edit: No, even with deactivated addon copying works - in a new profile too.

It is possible, that some kind of "web browser security feature" from an Anti-Virus-software works wrong.

Edited by IRON67
0

Share this post


Link to post
Share on other sites

I've noticed this also happens when you copy PNG images hosted on GitHub. In the case of GitHub, the PNG file is empty (0 bytes).

 

I did some bisecting of the Firefox versions, and found this behavior started in v51, and persists in the latest v53 alpha.

https://bugzilla.mozilla.org/show_bug.cgi?id=1340039

 

 

On 2/14/2017 at 7:13 AM, IRON67 said:

It is possible, that some kind of "web browser security feature" from an Anti-Virus-software works wrong.

I don't use a third-party anti-malware program; just Defender.

All further testing was done in a VM with a new install of Windows.

Can't say why you aren't seeing the issue manifesting.

0

Share this post


Link to post
Share on other sites
7 hours ago, toe_head2001 said:

Can't say why you aren't seeing the issue manifesting.

 

My PC likes me B)

 

Edit: Very funny: I just had the error in my Seamonkey 2.48 (my favourite browser) with the image by Humility (Photobucket) in this thread, but NOT with my Firefox. And the error appears only on my first try to copy the image. On second try it works. ¯\_(ツ)_/¯

Edited by IRON67
0

Share this post


Link to post
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.

0

Share this post


Link to post
Share on other sites

I suspect MS Paint is either:

1) just using the DIB and not trying any of the other formats first

2) using the DIB after it attempts to use the PNG file.

0

Share this post


Link to post
Share on other sites

No problem here copy + pasting the flower image from FireFox browser into PDN 3.5.11 running in Linux under wine. Perhaps it's a PDN 4.0.13 issue? I have v4.0.13 installed in a VM, but I don't let it have internet connection.

0

Share this post


Link to post
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?

0

Share this post


Link to post
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/

0

Share this post


Link to post
Share on other sites

Rick is unlikely to change his clipboard handling code.

 

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

0

Share this post


Link to post
Share on other sites

Something else I noticed between copy from FF or Chrome. Chrome preserves alpha channel and anti-aliasing when copying and pasting into PDN.

 

J0SdqVD.png

0

Share this post


Link to post
Share on other sites

This is becoming increasingly strange! The Firefox-Bug is not reproducible with me - also not with the transparency. I just tested it at toe_head2001's logo. It is all as it should be. I'm using Win 7 SP1, 64bit, Firefox 51.0.1, 64bit (Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:51.0) Gecko/20100101 Firefox/51.0 ID:20170125094131 CSet: 327e081221b064b05a302d7877c6e4be2949a617)

 

Edit:

 

I tried again (same result), but this time I've checked the clipboard with the "Free Clipboard Viewer".
It occurred to me that in the preview when copying with SeaMonkey is a text link or URL to the PNG file, while when copying with Firefox a preview with black background is shown.
Nevertheless, the correct image with transparency appears in Paint.NET after paste it from the clipboard.

 

Spoiler

 

clipb2.jpgclipb.jpg

 

Maybe my system has self-healing powers :roll:

 

 

 

Edited by IRON67
0

Share this post


Link to post
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).

0

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now