jimp-dev / jimp-dev/gifwrap

Using all ram

Open
#42 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
77
Forks
18
PR merge metrics
No merged PRs in 30d

Description

I am using the following function to try and create a thumbnail of a gif with a mask. icon.data is a buffer containing the gif data. The addMask function works with JIMP variables and works. even if I comment out the line that manipulates the frame it uses up all the ram and crashes with a FATAL ERROR: Ineffective mark-compacts near heap limit Allocation failed - JavaScript heap out of memory

```
let sourceGif=await codec.decodeGif(icon.data);
for (let i in sourceGif.frames) {
let frameImage = GifUtil.copyAsJimp(Jimp, sourceGif.frames[i]);
//frameImage=await addMask(frameImage,icon); //function that resizes a frame and adds a mask to the frame
sourceGif.frames[i]=new GifFrame(frameImage.bitmap);
}
GifUtil.quantizeDekker(sourceGif.frames, 256);

// The encoder determines GIF size from the frames, not the provided spec (sourceGif).
outputBuffer=codec.encodeGif(sourceGif.frames, sourceGif);

```

After some more checks I find that it is the GifUtil.quantizeDekker function causing the problem.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.