jimp-dev / gifwrap

A Jimp-compatible library for working with GIFs
MIT License
73 stars 17 forks source link

GifFrame constructor ignores options from BitmapImages #27

Open DetachHead opened 3 years ago

DetachHead commented 3 years ago

would be good to be able to read and write frame delay, as Omggif supports it

DetachHead commented 3 years ago

nevermind, turns out it's in GifFrame and was losing the GifFrameOptions here in my code

frames = image.frames.map(frame =>
    new GifFrame(
        (GifUtil.copyAsJimp(Jimp, frame) as Jimp).scaleToFit(maxSize, maxSize).bitmap,
        frame
    )
)

because of this check in its constructor:

image

is that meant to be there? there's no constructor type that would imply such behavior:

constructor(bitmap: JimpBitmap, options?: GifFrameOptions);
constructor(bitmapImage: BitmapImage, options?: GifFrameOptions);
constructor(width: number, height: number, buffer: Buffer, options?: GifFrameOptions);
constructor(width: number, height: number, backgroundRGBA?: number, options?: GifFrameOptions);
constructor(frame: GifFrame);