Scalebar

This module provides functionality for drawing and adding a scalebar to an image.

morphocut.scalebar.DrawScalebar()[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[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.