yt.extensions.image_writer.write_bitmap

yt.extensions.image_writer.write_bitmap(bitmap_array, filename, max_val=None)

Write out a bitmapped image directly to a PNG file.

This accepts a three- or four-channel bitmap_array. If the image is not already uint8, it will be scaled and converted. If it is not four channel, a fourth alpha channel will be added and set to fully opaque. The resultant image will be directly written to filename as a PNG with no colormap applied. max_val is a value used if the array is passed in as anything other than uint8; it will be the value used for scaling and clipping when the array is converted. Additionally, the minimum is assumed to be zero; this makes it primarily suited for the results of volume rendered images, rather than misaligned projections.

Parameters :

bitmap_array : array_like

Array of shape (N,M,3) or (N,M,4), to be written. If it is not already a uint8 array, it will be scaled and converted to uint8.

filename : string

Filename to save to

max_val : float, optional

The upper limit to clip values to in the output, if converting to uint8. If bitmap_array is already uint8, this will be ignore.

Previous topic

yt.extensions.image_writer.multi_image_composite

Next topic

yt.extensions.image_writer.write_image

This Page