Re: [Gimp-developer] Size on disk vs size reported on status bar


On Wed, Oct 4, 2017 at 2:28 PM, Jehan Pagès <jehan marmottard gmail com> wrote:
Hi again!

On Wed, Oct 4, 2017 at 1:01 PM, Elle Stone
<ellestone ninedegreesbelow com> wrote:
On 10/03/2017 09:33 PM, Jehan Pagès wrote:

I don't know how this info is computed in GIMP code (i.e. does it
check for actual memory size or does it do some basic maths as I am
about to do), but assuming your image is 8 bits per channel, and all 7
layers are the size of the image and have no alpha, that makes:
4000*6000*7*24 = 4 032 000 000 / 1024^3  ~ 3.8GB!:-)


Actually the image is at 32-bit floating point precision, all the layers
have alpha channels, most of the layers have masks, and there are a couple
extra channels (saved masks) in the channels dialog.

Ignoring the masks and the extra saved channels, and assuming I'm doing the
right math, this would be:

4000*6000*7*32*4 = 21 504 000 000 / 1024^3 ~ 20 GB

Sorry I was stupid earlier. By multiplying by 24 (or here 32), we get
the size in bits, we want in bytes (instead, we must multiply by 3
bytes for 32 bits). So a single mono-channel image should be
4000*6000*3 bytes.
So assuming each layer has alpha and mask, that makes 5 channels per
layer and each channel uses 3 bytes:
4000*6000*3*7*5 ~ 2.34 GB.

Ok so I meant 4 bytes of course! I can't even do basic maths right anymore! :P

4000*6000*4*7*5 ~ 3.2G.

Hopefully I didn't make too many errors this time. :P
You also said that there were a few extra channels. Selection is a
channel as well, so if you have one, it must be taken into account.
This said, I am wondering if the channels are all 3-bytes precision in
a 32-bit image?

Ok so I had a quick look at the code.
For the size displayed in the status bar, it seems it would use the
size as returned by each GimpObject through the get_memsize() virtual

You can get an idea of the expected size by looking at GimpTemplate
code which is used to guess the future memory size (to warn before
image creation if the expected size will be big):

We can see that the expected size seems to be based on the initial
layer + the selection + the projection (which apparently always has
alpha and multiplies the result by 1.33:
So for your image with 7 layers, alpha (and assuming all with mask),
following this estimation algorithm:
4000*6000*4*7*5 + 4000*6000*4 + 4000*6000*16*1.33 ~ 3.7GB.

This estimation is quite close to the actual 3.8GB GIMP gives you.
With the few more channels you said you had, I guess that's about it.



As an experiment, I followed Simon's suggestion and made a new document,
same size, 7 layers, and filled each layer with random LCH noise. This
brought the %m value up to 4.8 GB.

Removing all operations from the Undo history brought the %m value down to
2.9 GB. Saved to disk, the size is 1.6 GB. I guess random noise also


ZeMarmot open animation film

ZeMarmot open animation film

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]