import * as gw from "gif-writer" ; /**
 * Class which converts a pixel buffer into a gif image.
 */ export class ImageConvert implements gw . IOutputStream { buffer : number [ ] = [ ] ; writeByte ( b ) { this . buffer . push ( b ) ; } writeBytes ( bb ) { Array . prototype . push . apply ( this . buffer , bb ) ; } param width param height param pixels param palette param transparentIndex returns public static createGifFromArray ( width , height , pixels , palette , transparentIndex ? ) { let indexedImage = new gw . IndexedColorImage ( { width , height } , pixels , palette ) ; const gifImage = new ImageConvert ( ) ; const gifWriter = new gw . GifWriter ( gifImage ) ; gifWriter . writeHeader ( ) ; gifWriter . writeLogicalScreenInfo ( { width : indexedImage . width , height : indexedImage . height , } ) ; gifWriter . writeTableBasedImageWithGraphicControl ( indexedImage , { transparentColorIndex : transparentIndex } ) ; gifWriter . writeTrailer ( ) ; return gifImage . buffer ; } }