UNPKG

voluptasquisquam

Version:

Image processing and manipulation in JavaScript

24 lines (22 loc) 797 B
import Image from '../Image'; /** * Make a copy of the current image and convert to RGBA 8 bits * Those images are the one that are displayed in a canvas. * RGB model in 8 bits per channel and containing as well an alpha channel. * The source image may be: * * a mask (binary image) * * a grey image (8 or 16 bits) with or without alpha channel * * a color image (8 or 16 bits) with or without alpha channel in with RGB model * The conversion is based on {@link Image#getRGBAData}. * @memberof Image * @instance * @return {Image} - New image in RGB color model with alpha channel * @example * var rgbaImage = image.rgba8(); */ export default function rgba8() { return new Image(this.width, this.height, this.getRGBAData(), { kind: 'RGBA', parent: this }); }