Interface ImageFormatOptions

Options that affect image conversion with Editor.toImage and Editor.downloadImage.

Example: List image formats supported in this browser

micd.util.supportedImageFormats().forEach(fmt => {
  console.log(JSON.stringify(fmt, null, 2));
});
see

supportedImageFormats

Hierarchy

  • ImageFormatOptions

Index

Properties

Optional background

background: string | Color

Background colour for the image. This can be a Color instance or a CSS color string, such as "#fff". Default is "transparent".

Optional container

container: "string" | "url" | "blob"

Form in which the image data will be stored:

  • "url": The image will be stored as a string whose value is a data URL for the image. This is the default.
  • "string": The image will be stored as a raw string representation. This is only applicable for SVG images. Other image types will be treated as "url".
  • "blob": The image will be stored in a Blob object.

This option has no effect on downloadImage.

Optional foreground

foreground: string | Color

Default colour for math content in the image. This can be a Color instance or a CSS color string, such as "#fff". Default is "black".

Optional format

format: string

Image file format such as "png" or "svg". Default is "png". Other formats may be supported depending on the browser, such as "jpeg" or "avif". If the requested format is not available, a PNG image is produced.

Optional margin

margin: number

Size of the margin added around the outside of the image, in pixels. (For format "svg", the relative size of the margin will be comparable to a bitmap image with the same margin, but the absolute size of the margin will scale along with the rest of the image.) Default is 0.

Optional oversample

oversample: boolean

If true, the image may be rendered at a higher than requested resolution and then scaled down to the requested size. This may improve image quality. Default is true.

Optional quality

quality: number

Quality of lossy formats such as "jpeg", between 0 and 1. Default is 0.92.

Optional scale

scale: number

Scaling factor applied to the default image size. Ignored by format "svg". Default is 1.

This API is still under development and is subject to change. Copyright © Math I Can Do Solutions Incorporated and/or its licensors.