NativeImage

external class NativeImage(source)

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard

A boolean property that determines whether the image is considered a template image.

Functions

Link copied to clipboard

Add an image representation for a specific scale factor. This can be used to programmatically add different scale factor representations to an image. This can be called on empty images.

Link copied to clipboard

The cropped image.

Link copied to clipboard
fun getAspectRatio(scaleFactor: Double = definedExternally): Double

The image's aspect ratio (width divided by height).

Link copied to clipboard
fun getBitmap(options: BitmapOptions = definedExternally): Buffer

A Buffer that contains the image's raw bitmap pixel data.

Link copied to clipboard

A Buffer that stores C pointer to underlying native handle of the image. On macOS, a pointer to NSImage instance is returned.

Link copied to clipboard

An array of all scale factors corresponding to representations for a given NativeImage.

Link copied to clipboard
fun getSize(scaleFactor: Double = definedExternally): Size

If scaleFactor is passed, this will return the size corresponding to the image representation most closely matching the passed value.

Link copied to clipboard

Whether the image is empty.

Link copied to clipboard

Whether the image is a macOS template image.

Link copied to clipboard

The resized image.

Link copied to clipboard

Marks the image as a macOS template image.

Link copied to clipboard
fun toBitmap(options: ToBitmapOptions = definedExternally): Buffer

A Buffer that contains a copy of the image's raw bitmap pixel data.

Link copied to clipboard
fun toDataURL(options: ToDataURLOptions = definedExternally): String

The Data URL of the image.

Link copied to clipboard
fun toJPEG(quality: Double): Buffer

A Buffer that contains the image's JPEG encoded data.

Link copied to clipboard
fun toPNG(options: ToPNGOptions = definedExternally): Buffer

A Buffer that contains the image's PNG encoded data.