yt.data_objects.image_array.ImageArray.write_image

ImageArray.write_image(filename, color_bounds=None, channel=None, cmap_name='algae', func=<function <lambda>>)[source]

Writes a single channel of the ImageArray to a png file.

Parameters:

filename: string :

Note filename not be modified.

Returns:

scaled_image : uint8 image that has been saved

Other Parameters:
 

channel: int :

Which channel to write out as an image. Defaults to 0

cmap_name: string :

Name of the colormap to be used.

color_bounds : tuple of floats, optional

The min and max to scale between. Outlying values will be clipped.

cmap_name : string, optional

An acceptable colormap. See either yt.visualization.color_maps or http://www.scipy.org/Cookbook/Matplotlib/Show_colormaps .

func : function, optional

A function to transform the buffer before applying a colormap.

Examples

>>> im = np.zeros([64,128])
>>> for i in range(im.shape[0]):
...     im[i,:] = np.linspace(0.,0.3*i, im.shape[1])
>>> myinfo = {'field':'dinosaurs', 'east_vector':np.array([1.,0.,0.]),
...     'north_vector':np.array([0.,0.,1.]), 'normal_vector':np.array([0.,1.,0.]),
...     'width':0.245, 'units':'cm', 'type':'rendering'}
>>> im_arr = ImageArray(im, info=myinfo)
>>> im_arr.write_image('test_ImageArray.png')