Skip to content


Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time

jQuery plugin Watermark

npm FOSSA Status

JQuery plugin Watermark help you seal batch of images, like a stamp tool.

Because this plugin is written in HTML5 and Javascript, so it will operate without a server for image processing, bandwidth limit is no longer the thing you need to worry.

Suitable uses for low-bandwidth web server, or web creation services, free forums without management server as Blogspot, Forumotion, ...



  1. Using an image or text to stamp.
  2. Allows you to select a position to stamp on 8 corners of the image.
  3. Size and format options after the stamped image.
  4. Export image to base64 type, so might instead directly into the old photos or upload server allows, for example, Imgur.


  1. Does not work on older browsers that don't support HTML5.
  2. Cannot use images be limited server CORS headers according to the domain name. If this server in your rights management, you need to set up Apache as follows:
Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Headers "referer, range, accept-encoding, x-requested-with"


Direct download file or watermark.tar.gz or use the command line:


git clone


bower install watermark


npm install watermark

How to use

This plugin requires jQuery library from 1.5 or above, add it at the end of your HTML document as follows:

<!-- jQuery 1.5+ -->
<script src="jquery.js" type="text/javascript"></script>
<!-- jQuery plugin Watermark -->
<script src="jquery.watermark.js" type="text/javascript"></script>


$(function() {


Name Type Default Description
path String 'watermark.png' Path contains images used as a watermark, can use base64 image.
text String '' Text used as a watermark.
textWidth Number 130 Text width of frame surrounds, units: px.
textSize Number 12 Font size of text, units: px.
textColor String 'white' Text color, you can use HEX or RGBA color codes.
textBg String 'rgba(0, 0, 0, 0.4)' Background color, you can use HEX or RGBA color codes.
gravity String 'se' The position of the watermark on the image (nw, n, ne, w, e, sw, s, se, c).
opacity Number 0.7 The transparency of watermark, the value between 0 and 1.
margin Number 10 Distance from watermark to edge of image.
outputWidth Number 'auto' Image width after adding watermark, units: px or use 'auto'.
outputHeight Number 'auto' Image height after adding watermark, units: px or use 'auto'.
outputType String 'jpeg' Image format after adding watermark, You can use one of three types (jpeg, png, webp).
done Function function(imgURL){this.src=imgURL;} Called after image with watermark is created.
fail Function function(){} Called after an error of images is occurring.
always Function function(){} Called when processing finishes (done and fail).


  1. If you use the text parameter, path parameter will be disabled. The watermark will be created from the text you type in text parameter.
  2. In the outputType parameter, webp format only works on the Chrome browser. With other browsers, it will return the png format. Should avoid use png format, because image quality not much higher, but the output image size is quite large.


Basic usage

<img class="img_awesome" src="img/1.jpg" alt="" />
<img class="img_awesome" src="img/2.jpg" alt="" />
<img class="img_awesome" src="img/3.jpg" alt="" />
$(function() {

With this usage, you need put watermark.png image in the root directory. You can replace it by using the path parameter with an URL image or base64 image.

$(function() {
    path: ''

Choose output image size

For example, limit the maximum width is 500px.

$(function() {
    outputWidth: 500

You can also limit the height of image with outputHeight parameter. Should not use 2 size parameters simultaneously, because it can distort your image. Should only use a parameter, it will adjust the remaining parameter with image ratio.

Use text as watermark

Like 9gag style.

$(function() {
    text: 'GOOGLE.COM',
    textWidth: 100,
    gravity: 'w',
    opacity: 1,
    margin: 12

Use image URL

If you use the image URL, and you just want to export the image URL (added watermark), you can use the following ways:

One image

$(function() {
    $('<img>', {
        src: ''
        done: function (imgURL) {

Multiple images

$(function() {
    var inputImages = ['', '', ''];

    var outputImages = [];

    var defer = $.Deferred();
    $.when(defer).done(function () {

    $.each(inputImages, function (i, v) {
        $('<img>', {
            src: v
            done: function (imgURL) {
                outputImages[i] = imgURL;
                if (i + 1 === inputImages.length) {


MIT License © lelinhtinh

FOSSA Status