Getting Started with the UnmrkGemini SDK
The UnmrkGemini SDK provides a simple and powerful way to integrate watermark processing into your Node.js applications. This guide will show you how to install and use the SDK.
Installation
To use the SDK, you need to have Node.js installed on your system. You can install the UnmrkGemini library from npm:
npm install unmrkgemini
Basic Usage
The WatermarkEngine class is the main entry point for using the SDK. You can use it to process single images or batch process multiple images.
Processing a Single Image
Here’s how to remove a watermark from a single image:
const { WatermarkEngine } = require('unmrkgemini');
const path = require('path');
async function main() {
const engine = new WatermarkEngine();
await engine.init();
const inputPath = path.join(__dirname, 'input.jpg');
const outputPath = path.join(__dirname, 'output.jpg');
// To remove a watermark
await engine.processImage(inputPath, outputPath, true);
}
main();
To add a watermark instead, simply pass false as the third argument to processImage:
// To add a watermark
await engine.processImage(inputPath, outputPath, false);
Batch Processing
You can easily process multiple images in a loop:
const { WatermarkEngine } = require('unmrkgemini');
async function batchProcess() {
const engine = new WatermarkEngine();
await engine.init();
const images = ['img1.jpg', 'img2.jpg', 'img3.jpg'];
for (const image of images) {
await engine.processImage(
`input/${image}`,
`output/${image}`,
true // remove watermark
);
}
}
batchProcess();
API Reference
WatermarkEngine
The main class for processing images with watermarks.
init(): Initializes the watermark engine.processImage(inputPath, outputPath, remove): Processes a single image.inputPath: Path to the input image.outputPath: Path to save the processed image.remove: A boolean indicating whether to remove (true) or add (false) a watermark.
We hope this guide helps you get started with the UnmrkGemini SDK. If you have any questions, feel free to reach out to us at apps@hotbrains.com.br.