In the forums I received very often the question :
I got the failure “Fatal error: Out of memory ” or “Error : Exceed Memory limit. Require : xx.xx MByte”, but my image has only the size of 1 MB ?
After I answered this question now 1000 times , I hope this post will clarify this point. Let’s create a white image with the size of 640 x 480 (It’s the VGA resolution) and open this with a image viewer like IrfanView.
Let’s have a look at the bottom line :
The image requires a disk space (the file size) of 5.30 KB and a memory size of 900.04 KB
Now increase the resolution to 1024 x 768 :
The image requires still the file size of 5.30 KB but a memory size of 2.25 MB
Now look for a 4 Megapixel image (Resolution 2304 x 1728) :
The required memory size increases to 11.39 MB
And a 7.1 MP camera picture :
We need now 20.25 MB memory , but the file size is still 5.30 KB.
What do we learn from this test ? JPG, PNG (and other compression format’s) reduces the file size, but for image manipulation we need for each pixel a lot of memory space:
File size is not equal to the required memory space.
Inside the most web server the common image manipulation library for PHP is called GD and this library doesn’t work different then programs like Photoshop, Paintshop or others. A very rough calculation for the memory need under GD library is :
Width x Height x 8 (bits) x 3(channels) / 8 x 1.65
NextGEN Gallery shows you the current memory usage of WordPress and all loaded plugins inside the server settings :
Now have a look at your Memory Limit in the server settings and you can calculate the maximum resolution for your images, which you can manipulate (create thumbnails) with the GD library. It’s possible to change the memory limit, but there exist various way’s and not all of them are allowed at your web server. At the best contact your web hoster, if you want to increase this limit. A good and useful value for images is a limit of 64 MB.