I want to add a custom watermark to the static map images. Is there an option to do this directly through the API?
Our Static Map API does not currently have a built-in option for adding custom watermarks. You can use an image editing library or tool to add watermarks to the generated map images programmatically.
If you're working with NodeJS, you can use the "sharp" library.
const sharp = require('sharp');const mapImage = 'path/to/static/map/image.png';const watermarkImage = 'path/to/watermark/image.png';sharp(mapImage) .composite([{ input: watermarkImage, gravity: 'northwest' }]) .toFile('output-image-with-watermark.png');
const sharp = require('sharp');
const mapImage = 'path/to/static/map/image.png';
const watermarkImage = 'path/to/watermark/image.png';
sharp(mapImage) .composite([{
input: watermarkImage, gravity: 'northwest' }])
.toFile('output-image-with-watermark.png');
"ImageMagick" is another popular library that supports Linux, Windows, and macOS. It can be used over command line and has an API for most popular languages like PHP and C.
PHP - How to add watermark
Hope this helps!
Register or Login to Post