#
GIF Creation Guide
This script utilizes the ApexPainter
class from the apexify.js
library to creat gif using multiple sets of images
.
#
Usage
To create a GIF using the ApexPainter
class, follow these steps:
const { ApexPainter } = require('apexify.js');
import { ApexPainter } from 'apexify.js';
- Create an instance of the
ApexPainter
class:
const painter = new ApexPainter();
2.Define the options for the GIF:
- Prepare an array of images to include in the GIF. Each image should be represented as an object with the following properties:
const images = [
{ source: 'image1.png', isRemote: false },
{ source: 'image2.png', isRemote: false },
{ source: 'https://w7.pngwing.com/pngs/417/624/arrow.png', isRemote: true }
];
const options = {
outputFile: 'output.gif',
repeat: 0,
quality: 10,
delay: 3000,
watermark: {
enable: true,
url: 'watermark.png'
},
textOverlay: {
text: 'Sample Text',
fontName: 'Arial',
fontSize: 20,
fontColor: 'white',
x: 10,
y: 30
}
};
const outputGif = await painter.createGIF(images, options);
Note
The option outputFile
can be "buffer", "file", "attachment", or "base64".