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

On 10/04/2017 09:02 AM, Jehan Pagès wrote:

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:
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.

Hi Jehan,

So a byte is 8 times a bit? For people like me who can never remember the difference between a byte and a bit, is there a one-sentence explanation for why there are bytes *and* bits?

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.

Thanks! That's a nice explanation! This might be useful to put in the user's manual, if it isn't already there.


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