canvaskit-wasm 0.39 build 2026-04-29

ImageInfo

A plain JS object describing the pixel layout of an image / surface / pixel buffer. Required by MakeRasterDirectSurface, MakeImage, Canvas.readPixels, and similar APIs that need to know how to interpret raw bytes.

const info = {
  width: 256,
  height: 256,
  colorType: CK.ColorType.RGBA_8888,
  alphaType: CK.AlphaType.Unpremul,
  colorSpace: CK.ColorSpace.SRGB,
};

Fields

FieldTypeNotes
widthnumberImage width in pixels.
heightnumberImage height in pixels.
colorTypeColorTypePer-pixel byte layout (RGBA_8888, BGRA_8888, RGBA_F16, RGBA_F32, etc.).
alphaTypeAlphaTypePremul / Unpremul / Opaque.
colorSpaceColorSpaceSRGB / DisplayP3 / AdobeRGB.

PartialImageInfo is the result of image.getImageInfo() — same fields but doesn't carry a colorSpace.

See also