mattdesl / gifenc

fast GIF encoding
MIT License
277 stars 19 forks source link

Ability to set frame X and Y position #11

Open BjarkeNL opened 3 years ago

BjarkeNL commented 3 years ago

Thanks for a cool encoder - much faster than the others I've tried for Node so far, and very nice that it is as flexible as it is! :)

You can already set a frames width and height independently of the other frames, but the (x,y) position of a frame is hardcoded to (0,0). If would be nice to be able to specify the x and y positions for writeFrame. (for optimization reasons - it becomes faster to generate a GIF where only a small part of the image changes from frame to frame)

It could for example be part of the "opts" parameter, something like:

        encoder.writeFrame(pixels8bit, width, height, {
            ...
            x = 123, 
            y = 456
        });
mattdesl commented 3 years ago

Good call ! Will accept a PR for that. :)