plotting large images

Hi,

You could, before plotting, sum the different image arrays? Depending on whether you are plotting RGB(A) images or greyscale images, you could take the sum of the color channels, or take a weighted average.

Yes, I will probably merge the images (RGBA) before plotting. I want to create more plots and even with this optimization every plot will take 300 MB… Is there any way how to save some memory?

Best

Stepan

Those numbers actually make a lot of sense.

For a 4k by 4k 2D array of 64-bit floats, you’re using 128MiB of memory, just to store them. Displaying such an array with mpl would take a copy of that and add some objects for housekeeping (on my machine about 150MB to display one such array together with the housekeeping objects).

You could look at whether or not you actually need 64-bit precision. Often times, 8-bit precision per color channel is justifiable, even in grayscale. My advice is to play with the dtype of your array or, as you mentioned, resample.

Also, is it needed to keep all images? It sounds to me like your application will become very resource hungry if you’re going to be displaying several of these 2D images over each other (and if you don’t use transparency, you won’t get any benefit at all from plotting them together).

···

2013/8/27 Štěpán Turek <stepan.turek@…2526…>

Hi,

You could, before plotting, sum the different image arrays? Depending on whether you are plotting RGB(A) images or greyscale images, you could take the sum of the color channels, or take a weighted average.

Yes, I will probably merge the images (RGBA) before plotting. I want to create more plots and even with this optimization every plot will take 300 MB… Is there any way how to save some memory?

Best

Stepan