Jump to content

Out of Memory error with image resize


Recommended Posts

Hi,

I am fairly new to Paint.net but I am hooked.

I am working with some very large bitmap files (e.g. 60 MB). I assumed that my memory was the problem causing an 'out of memory' error when I tried to resize an image ( using nearest neighbour) so I upgraded my RAM from 512 MB to 2GB. I still get the error. I have an 80GB HD with about 25% used so I don't think it is a disk limitatation. Is there any way around this problem?

Thank you,

Dale

Link to comment
Share on other sites

Moved to Bugs & Troubleshooting

A few questions: What is the size of the image, in pixels? You can view the properties in an explorer window.

Second, please post the contents of the pdncrash.log text file, it should be on your desktop.

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

Moved to Bugs & Troubleshooting

A few questions: What is the size of the image, in pixels? You can view the properties in an explorer window.

Second, please post the contents of the pdncrash.log text file, it should be on your desktop.

The image is 7680 x 2880 pixels and 63.2 MB. Compressing the file in properties does not help. There is no crash log. I get a window saying "Not enough memory to resize the image".

Thank you for your help Rick.

Link to comment
Share on other sites

Hi Rick,

I know the error message is telling there is not enough memory but I increased my computer's RAM from 512MB to 2GB and I get the same message. What can I do to get around this problem?

Thank you,

Dale

Link to comment
Share on other sites

I know super sampling takes a lot of memory. I do not know exactly how much, but it definitely (hopefully) shouldn't be enough to take up all of that. I can resize something bigger with only 630 MB of physical memory. What is your paging file size?

~~

Link to comment
Share on other sites

Paint.NET's architecture is such that it must:

1) Hold the entire image in memory

2) Have a bitmap used for compositing the image

3) Have a scratch surface

(3) is not always in use, but it's important to have it allocated because it makes error handling much simpler. If you clicked on the Clone Stamp and suddenly got an out of memory error, that would be lame. (2) is not always important, as a single layer image effectively needs no compositing.

So, to compute the memory requirements for an image, the following formula can be used:

(W x H x 4) x (L + 2)

W is the width of the image in pixels, H is the height in pixels, 4 is because each pixel takes 4 bytes, L is the number of layers, and the +2 accounts for (2) and (3) above.

So for your 7680x2880 image, which I assume has 1 layer, the total memory required is:

(7680 x 2880 x 4) x (1 + 2)

= (88473600) x (3)

= 265,420,800

= 253.125 MB RAM

When you resize an image, you must have enough memory to hold the image at both its old and new sizes. Other factors influence how much memory is available. For instance, just because there is still 1 GB of virtual address space available does not mean that there is 1 GB available contiguously.

Programs like Photoshop and The GIMP have complicated memory managers that tile the image, swapping it out to scratch pads (disk) as necessary. This impacts coding complexity because every part of the application that works with the image must take the tiling in to consideration. It also affects performance, but has the advantage of being able to work with much larger images. For Paint.NET, I purposely chose a design that enabled coding simplicity for many reasons.

If you have a 64-bit CPU and OS, you will have a much harder time running out of memory. You may also look into the /3GB switch for the boot.ini file, although I do not know for sure that this will help: http://support.microsoft.com/default.as ... E05B0ABAAA

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...
So, to compute the memory requirements for an image, the following formula can be used:

(W x H x 4) x (L + 2)

Ouf.

Some time ago I created a 10240 x 7680 pixel image by mistake. (I wanted to create a 1024 x 768 :D)

(10,240 x 7,680 x 4) x (1 + 2) / 1024 / 1024 =

943,718,400 / 1024 / 1024 =

900 MB, ouf!

BTW: I have got 1 GB RAM, so 900 MB plus the memory, which Windows needs plus some other opened prgramms..

Eventually, it had to be cached, muhaaa.

Greets

Flo

Link to comment
Share on other sites

  • 4 months later...

I have got this same issue of out of memory but on an image that is only 1px by 54px (190Bytes). Now I have a top of the range laptop with 1gb ram so I cant see any reason that this would actually be a memory issue. I resized two other images (larger size) no probs and then this one and any subsequent ones will not resize. I have nothing else running so memory should not be an issue. Sounds like you have a bug after all! All i'm doing is opening the image, and then trying to resize it by 50%. I have no error log to send you as none was produced.

Link to comment
Share on other sites

  • 2 weeks later...
Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...