there are probably a few things we could try to do to reduce memory
usage when working with large images. The main problem here is that if
you open an RGB image (no alpha channel) with say 1000 x 1000 pixels,
you would expect GIMP to use 1000 * 1000 * 3 bytes to store the image
data. You will however notice that GIMP instead needs 8 bytes per
pixel. In addition to the 3 bpp for the RGB layer it allocates a
projection the size of the image. This projection holds the result of
compositing the layer stack. It is always allocated 4 bpp. Additionally
a selection mask is allocated which adds another byte per pixel.

So what could be done to improve this? We could for example try to get
around the need for a projection for the case where people are working
with a single layer only. Instead of displaying from the projection,
we could display directly from the layer. Of course we would still
have to allocate the projection as soon as you start to work with
layers or floating selections but at least we could reduce the memory
footprint that is needed to open the image and have a first look at it.
A more elegant way to implement this is is to share the projection
tiles with layer tiles whenever possible (i.e. when the topmost layer
is in Normal mode and the tile is completely opaque).

It might also help to allocate the selection lazily. That is to not
allocate the tiles at all until the selection mask is altered. This
might actually happen already, I am not sure about it.

Gimp-developer mailing list

Reply via email to