Options
All
  • Public
  • Public/Protected
  • All
Menu

The Image class represents generic image data

Hierarchy

  • Image

Index

Constructors

constructor

  • new Image(width: number, height: number, data: Buffer, channels: number, id: string, colorMode?: ColorMode, pixelDensity?: { scaleX: number; scaleY: number }): Image
  • Image class constructor

    Parameters

    • width: number

      Image width in pixels

    • height: number

      Image height in pixels

    • data: Buffer

      Generic Image data

    • channels: number

      Amount of Image channels

    • id: string

      Image identifier

    • colorMode: ColorMode = ...

      An images color mode, defaults to ColorMode.BGR

    • pixelDensity: { scaleX: number; scaleY: number } = ...

      Object containing scale info to work with e.g. Retina display data where the reported display size and pixel size differ (Default: {scaleX: 1.0, scaleY: 1.0})

      • scaleX: number
      • scaleY: number

    Returns Image

Properties

Readonly channels

channels: number

Readonly colorMode

colorMode: ColorMode = ...

Readonly data

data: Buffer

Readonly height

height: number

Readonly id

id: string

Readonly pixelDensity

pixelDensity: { scaleX: number; scaleY: number } = ...

Type declaration

  • scaleX: number
  • scaleY: number

Readonly width

width: number

Accessors

hasAlphaChannel

  • get hasAlphaChannel(): boolean

Methods

toBGR

  • toBGR(): Promise<Image>

toRGB

  • toRGB(): Promise<Image>

Static fromRGBData

  • fromRGBData(width: number, height: number, data: Buffer, channels: number, id: string): Image