|
From: Christoph G. <cg...@uc...> - 2011-02-04 03:36:25
|
On 2/3/2011 6:50 PM, Eric Firing wrote: > On 02/03/2011 03:04 PM, Benjamin Root wrote: > >> Also, not to sound too annoying, but has anyone considered the idea of >> using compressed arrays for holding those rgba values? > > I don't see how that really helps; as far as I know, a full rgba array > has to be passed into agg. What *does* help is using uint8 from start > to finish. It might also be possible to use some smart downsampling > before generating the rgba array, but the uint8 route seems to me the > first thing to attack. > > Eric > >> >> Ben Root > Please review the attached patch. It avoids generating and storing float64 rgba arrays and uses uint8 rgba instead. That's a huge memory saving and also faster. I can't see any side effects as _image.fromarray() converts the float64 input to uint8 anyway. So far other attempts to optimize memory usage were thwarted by matplotlib's internal use of masked arrays. As mentioned before, users can provide their own normalized rgba arrays to avoid all this processing. Christoph |