PYME.IO.rgb_image module

PYME.IO.rgb_image.base64_image(image, zoom=1.0, scaling='min-max', scaling_factor=0.99, colorblind_friendly=False, type='png')

Jinga2 filter which converts an image stack (PYME.IO.image.ImageStack) into a base64 encoded image suitable for inline incorporation into an html page.

Use with the following (or similar) html template code:

<img src="data:image/png;base64,{{ image|base64_image(scaling='percentile') }}">

can also output as jpg (or anything supported by both html and PIL) if the type parameter is set AND the html code is altered to give the correct mime type.

Parameters
image: a PYME.io.image.ImageStack instance
zoom: float, how large to zoom the image
scaling: string, how to scale the intensity - one of ‘min-max’ or ‘percentile’
scaling_factor: float, Percentile only - which percentile to use
colorblind_friendly: bool, Use cyan, magenta, and yellow rather than RGB to better accommodate colourblind users
type: string, image type. See PIL / Pillow documentation for details.
Returns
a b64 encoded string
PYME.IO.rgb_image.image_to_cmy(image, *args, **kwargs)
PYME.IO.rgb_image.image_to_rgb(image, zoom=1.0, scaling='min-max', scaling_factor=0.99)