Scalebar
This module provides functionality for drawing and adding a scalebar to an image.
- morphocut.scalebar.DrawScalebar(image: ndarray | Variable[ndarray], length_unit, px_per_unit=1, unit='px', fg_color=0, bg_color=255, font_family='sans', margin=10)[source]
Append a scalebar to an image.
- Parameters:
image – The image to append the scalebar to.
length_unit – The length of the scalebar in the specified unit.
px_per_unit – The ratio of pixels to units for the scalebar.
unit – The unit of length for the scalebar.
fg_color – The color to use for the scalebar and text.
bg_color – The color to use for the background.
font_family – The font family to use for the scalebar text.
margin – The margin to use around the scalebar.
- morphocut.scalebar.draw_scalebar(length_unit, px_per_unit=1, unit='px', mode='L', fg_color=0, bg_color=255, font_family='sans', margin=10)[source]
Draw a scalebar image of specified length and units.
- Parameters:
length_unit – The length of the scalebar in the specified unit.
px_per_unit – The ratio of pixels to units for the scalebar.
unit – The unit of length for the scalebar.
mode – The color mode to use for the PIL image.
fg_color – The color to use for the scalebar and text.
bg_color – The color to use for the background.
font_family – The font family to use for the scalebar text.
margin – The margin to use around the scalebar.
- Returns:
A numpy array representing the image of the scalebar.