Logo Formatting

Logo formatting. Each formatter is a function f(data, format) that draws a representation of the logo. The main graphical formatter is eps_formatter. A mapping ‘formatters’ containing all available formatters . Each formatter returns binary data. The eps and data formats can decoded to strings, e.g. eps_as_string = eps_data.decode()

weblogo.logo_formatter.pdf_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in PDF format.

weblogo.logo_formatter.jpeg_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in JPEG format.

weblogo.logo_formatter.svg_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in Scalable Vector Graphics (SVG) format. Requires the program ‘pdf2svg’ be installed.

weblogo.logo_formatter.png_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in PNG format.

weblogo.logo_formatter.png_print_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in PNG format with print quality (600 DPI) resolution.

weblogo.logo_formatter.txt_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Create a text representation of the logo data.

weblogo.logo_formatter.eps_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

Generate a logo in Encapsulated Postscript (EPS)

weblogo.logo_formatter.formatters = {'eps': <function eps_formatter>, 'jpeg': <function jpeg_formatter>, 'logodata': <function txt_formatter>, 'pdf': <function pdf_formatter>, 'png': <function png_formatter>, 'png_print': <function png_print_formatter>, 'svg': <function svg_formatter>}

Map between output format names and corresponing logo formatter

weblogo.logo_formatter.default_formatter(logodata: weblogo.logo.LogoData, logoformat: weblogo.logo.LogoFormat) → bytes

The default logo formatter.

class weblogo.logo_formatter.GhostscriptAPI(path: os.PathLike = None)

Interface to the command line program Ghostscript (‘gs’)

convert(format: str, postscript: str, width: int, height: int, resolution: int = 300) → bytes

Convert a string of postscript into a different graphical format

Supported foramts are ‘png’, ‘pdf’, and ‘jpeg’.

Raises:ValueError – For an unregonized format.
version() → str

Returms: The ghostscript version string