plotting large images

Hi,

I would like to plot multiple overlayed 4096x4096 images in one axes. If I run this code the plot takes 300 MB of memory:

import numpy as np

import matplotlib.pyplot as plt

if name == ‘main’:

img = np.zeros((4096, 4096))

img[100: 300, 100:1500] = 200

imgplot = plt.imshow(img)

plt.show()

And it takes additional 300 MB for every image with this size added into plot . Is there any way to reduce memory
consumption without need of data resampling?

My configuration:

Matplotlib 1.2.1

Numpy 1.7.1

Ubuntu 13.04 64 bit

Best

Stepan

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.

The method you use here depends strongly on the image type, but it will reduce memory consumption.

Just a thought.

···

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

Hi,

I would like to plot multiple overlayed 4096x4096 images in one axes. If I run this code the plot takes 300 MB of memory:

import numpy as np

import matplotlib.pyplot as plt

if name == ‘main’:

img = np.zeros((4096, 4096))

img[100: 300, 100:1500] = 200

imgplot = plt.imshow(img)

plt.show()

And it takes additional 300 MB for every image with this size added into plot . Is there any way to reduce memory
consumption without need of data resampling?

My configuration:

Matplotlib 1.2.1

Numpy 1.7.1

Ubuntu 13.04 64 bit

Best

Stepan


Introducing Performance Central, a new site from SourceForge and

AppDynamics. Performance Central is your source for news, insights,

analysis and resources for efficient Application Performance Management.

Visit us today!

http://pubads.g.doubleclick.net/gampad/clk?id=48897511&iu=/4140/ostg.clktrk


Matplotlib-users mailing list

Matplotlib-users@lists.sourceforge.net

https://lists.sourceforge.net/lists/listinfo/matplotlib-users