Image Selection
The user selects a main image and a watermark image (logo).
Images are loaded using the JavaScript FileReader or Image() object.
FileReader
Image()
Canvas Rendering
The main image is drawn onto an HTML <canvas> element.
<canvas>
The canvas automatically adjusts its width and height to match the main image dimensions to preserve quality.
Watermark Application
The watermark (logo or text) is drawn on top of the main image using drawImage() or fillText().
drawImage()
fillText()
Supports:
Custom position (top-left, top-right, bottom-left, bottom-right, center)
Opacity control using globalAlpha
globalAlpha
Scaling relative to the main image
Padding / margins
Rotation (optional)
Final Image Output
The watermarked image is exported from the canvas using:
canvas.toDataURL() ? Base64 output
canvas.toDataURL()