Philipp Lies wrote: > On 02/12/2010 07:49 PM, Eric Firing wrote: > >> Philipp Lies wrote: >> >>> Hi, >>> >>> is there a backend that supports 16bit tiff images? >>>
The macosx backend supports tiff. -Jeff >> Can you just use png, and use the netpbm utilities or ImageMagick >> convert program to go to and from tiff? >> > Would be 'dirty' but acceptable if matplotlib would support saving > uncompressed grayscale uint16 png files. But saving nxm uint16 arrays > leads to nxmx3 float arrays which do not even closely resemble my > original data. > Example: > A > array([[47705, 11865, 739, 16941, 37700], > [64321, 26860, 49945, 63556, 13498], > [ 2676, 7720, 5995, 22399, 32735], > [56577, 34443, 6636, 23409, 61331], > [ 1020, 26013, 34677, 37262, 36136]], dtype=uint16) > imsave('t.png',A) > B = imread('t.png') > B[:,:,0] > > array([[ 1., 0., 0., 0., 0.74117649], > [ 0.49803922, 0.19607843, 1., 0.5529412 , 0. ], > [ 0., 0., 0., 0., 0.48627451], > [ 1., 0.57647061, 0., 0.01960784, 0.71372551], > [ 0., 0.14509805, 0.58823532, 0.72941178, 0.66666669]], > dtype=float32) > > > >>> According to the website GDK supports tiff but that's wrong: >>> >>> >>>>>> import matplotlib >>>>>> matplotlib.use('GDK') >>>>>> import matplotlib.pyplot as pyplot >>>>>> pyplot.imsave(arr=X, fname='test.tif') >>>>>> >>> Traceback (most recent call last): >>> File "<stdin>", line 1, in <module> >>> File "/usr/lib/pymodules/python2.6/matplotlib/pyplot.py", line 1425, >>> in imsave >>> return _imsave(*args, **kwargs) >>> File "/usr/lib/pymodules/python2.6/matplotlib/image.py", line 813, in >>> imsave >>> fig.savefig(fname, dpi=1, format=format) >>> File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 1033, >>> in savefig >>> self.canvas.print_figure(*args, **kwargs) >>> File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line >>> 1420, in print_figure >>> '%s.' % (format, ', '.join(formats))) >>> ValueError: Format "tif" is not supported. >>> Supported formats: emf, eps, pdf, png, ps, raw, rgba, svg, svgz. >>> >>>>>> matplotlib.backends.backend >>>>>> >>> 'gdk' >>> >>> matplotlib 0.99.0 python 2.6.4 ubuntu karmic x64 >>> >>> If matplotlib cannot provide tiff support, does someone know an >>> alternative? PIL doesn't work either, at least not intuitively. >>> >>> Cheers >>> >>> Philipp >>> >>> > > ------------------------------------------------------------------------------ SOLARIS 10 is the OS for Data Centers - provides features such as DTrace, Predictive Self Healing and Award Winning ZFS. Get Solaris 10 NOW http://p.sf.net/sfu/solaris-dev2dev _______________________________________________ Matplotlib-users mailing list Matplotlib-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/matplotlib-users