matplotlib/matplotlib — pull request #3451 by nicolas-pascal (2014-09-02 15:36:25+00:00)
Title: Change hard coded image size limits from (32768, 32768) pixels to (INT_MAX, INT_MAX)

While trying to set a big image on a CentOS6 64bits platform, I have encoutered the error message :
---
Traceback (most recent call last):
File "soda_333m_browser.py", line 222, in
test()
File "soda_333m_browser.py", line 219, in test
draw(infile)
File "soda_333m_browser.py", line 211, in draw
fig.savefig (outfile)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/figure.py", line 1470, in savefig
self.canvas.print_figure(*args, **kwargs)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backends/backend_qt5agg.py", line 161, in print_figure
FigureCanvasAgg.print_figure(self, *args, **kwargs)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backend_bases.py", line 2192, in print_figure
**kwargs)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 513, in print_png
FigureCanvasAgg.draw(self)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 456, in draw
self.renderer = self.get_renderer(cleared=True)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 473, in get_renderer
self.renderer = RendererAgg(w, h, self.figure.dpi)
File "/usr/ops/env64_rhel6/lib64/python2.6/site-packages/matplotlib-1.4.0-py2.6-linux-x86_64.egg/matplotlib/backends/backend_agg.py", line 94, in __init__
self._renderer = _RendererAgg(int(width), int(height), dpi, debug=False)
ValueError: width and height must each be below 32768
---

So I dived deep down into the C++ wrappers, and it appears that image sizes have a hard coded limit of 32768 pixels. Actually, this limitation should be different on 64bits platform, so I've turned this number into the C stdlib constant "INT_MAX" to adapt it more "dynamically" to the target platform.

This fix works perfectly for me but should be tested on a 32bits platform (but I don't have one)