From: Friedrich R. <fri...@gm...> - 2010-03-30 21:10:11
|
2010/3/30 Filipe Pires Alvarenga Fernandes <oc...@gm...>: > However, my knowledge of python is very limited, even though I think I > understood what you suggested I do not know how to get the shape (of > the figure?) for this part: > >>>> fig.set_size_inches(float(shape[0]) / dpi, float(shape[1]) / dpi) > > error is: > > Traceback (most recent call last): > File "blueearth-map.py", line 108, in <module> > fig.set_size_inches(float(shape[0]) / dpi, float(shape[1]) / dpi) > TypeError: 'function' object is unsubscriptable > > It seems that it ended up calling a function shape instead of a variable shape. You're completely right, I assumed that you fill in some 2-element vector in *shape*, it was intended as an /argument/. The function attemted to be indexed is imported from numpy by matplotlib.pyplot: There is a code line "from numpy import *". So, simply put some line somewhere like: shape = [500, 500] . You have to set or have to calculate the figure's shape in pixels somewhere, because you need it to convert the rgb string back into a PIL image. It's not that nice, I know, for your problem? Friedrich |