How Can We Help You?

Watermarking

Image Watermarking is the process of adding an additional, usually modest image to your graphics to prevent them from being circulated without your permission. Watermark alignment, shape, padding, and alpha transparency can all be controlled with Picsmize.


Watermark ID

To add watermarks to your images, first submit the watermark(s) to your Picsmize account, then use just the unique IDs we issue them internally. API calls requesting picture watermarking will be significantly faster because watermark files will be securely stored on our machines.

Simply supply a watermark id within a watermark hash to advise the API to utilize an uploaded watermark

The API will place the watermark in the centre of a picture by default, regardless of its dimensions or opacity. Let's look at a very simple example:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735'
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Given the input image 750px × 300px
Resizing An Image Online
And a watermark ID "610ba78772e19003-1628153735"
Compressor Photo
Apply the watermark on the center of the image
Image Online Resize

You can change a watermark's default centre location by specifying one of the following gravity values: top-left, top, top-right, right, bottom-right, bottom, bottom-left, left.

Set the gravity value to top-right to place a watermark in the top-right corner, for example:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735 in the top-right corner.
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'gravity' => 'top-right'
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"gravity": "top-right"
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735 in the top-right corner.
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"gravity": "top-right",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Compress Jpeg
Watermark Padding

You can additionally specify a watermark padding option when using gravity to position a watermark, which accepts a positive integer and indicates the distance between the watermark and image boundaries.

Assume you want your watermark to be in the bottom-right corner, with a 30px padding:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735 in the bottom-right corner,
* with 30px padding
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'gravity' => 'bottom-right'
'padding' => 30
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"gravity": "bottom-right"
"padding": 30
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735 in the bottom-right corner.
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"gravity": "bottom-right",
													"padding": 30,
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Compressing An Image
Watermark Coordinates

You can use x and y attributes instead of gravity if you know the exact coordinates where you want your watermark to go. The origin (zero point) lies in the top-left corner of the image.

To place a watermark exactly at x:200, y:150 for example.

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735,
* and position at x=200, y=150
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'x' => 200
'y' => 150
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"x": 200
"y": 150
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735,
											* and position at x=200, y=150
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"x": 200,
													"y": 150,
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Compress The Photo
Watermark Opacity

Watermark opacity provides a new opacity parameter. For altering the opacity of the watermark, it takes a positive floating-point number in the range 0.01 - 1.00.

Use the following parameters, for example, to apply a watermark with 0.75 opacity in the centre:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735 in the center with 0.75 opacity
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'opacity' => 0.75
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"opacity": 0.75
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735 in the center with 0.75 opacity
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"opacity": 0.75,
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Images Size Reducer
Watermark Size and Scale

You can down sample your watermarks in two ways: within the watermark hash, by supplying width and/or height parameters, or by specifying a scale parameter that takes a float in the range 0.01 - 1.00. Watermarks should never be enlarged because this would degrade the image's quality. It's usually ideal to supply larger watermark images to the API and then resize/scale them down if necessary.

When the scale argument is set to true, the API will down sample the watermark image by the scale value. Scale the watermark down to 75% of its original size and place it in the top-left corner with 50px padding.

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735,
* in the top-left corner with scale down to 75%
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'gravity' => top-left,
'padding' => 50,
'scale' => 0.75
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"gravity": "top-left",
"padding": 50,
"scale": 0.75
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735,
											* in the top-left corner with scale down to 75%
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"padding": 50,
													"scale": 0.75,
													"gravity": "top-left",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Resizing Of Image

The API will automatically calculate the watermarks dimensions in an auto mode, if the width and/or height parameters are provided. This suggests that the watermarks will always be down-sampled in accordance with its aspect ratio to stay within the set dimensions.

For example, to resize a watermark to a maximum width of 150px and insert it in the top-left corner with 50px padding, use the following formula:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735,
* in the top-left corner with width to 150px
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'gravity' => top-left,
'padding' => 50,
'width' => 150
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"gravity": "top-left",
"padding": 50,
"width": 150
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735,
											* in the top-left corner with width to 150px
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"padding": 50,
													"width": 150,
													"gravity": "top-left",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Resizing An Image Online
Watermark Fit Mode

Even if the dimensions of a specified watermark exceed the dimensions of the input image, the Picsmize Image API will not change its size by default. Take a look at the following example output from the API when the watermark size is larger than the image size:

Resizing Pictures

By providing the fit option to true within the watermark hash, you can tell the API to down sample larger watermarks to fit entirely within the image constraints. It's worth noting that, due to quality issues, the API will never upscale smaller watermarks to fit inside image constraints.

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735,
* in the top-left corner with width to 150px
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'fit' => true
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735",
"fit": true
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735,
											* in the fit to "true"
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"fit": true,
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Compress A Png

You can optionally specify gravity, padding, and opacity values in addition to the fit parameter. For example, suppose you want to include a larger watermark with a 10px padding, align it to the top, and make it semi-transparent by setting the opacity value to 0.8:

<?php

/**
* Instantiate new `$picsmize` by calling a constructor
*/

$picsmize = new Picsmize('your-api-key');

/**
* Provide a publicly available image URL with fetch(string) method,
* and apply a watermark ID 610ba78772e19003-1628153735 in the fit to top
* with 10px padding and 0.8 opacity
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->watermark(array(
'id' => '610ba78772e19003-1628153735',
'fit' => true,
'gravity' => top,
'padding' => 10,
'opacity' => 0.8
))
->toJSON(function ($response) {
if ($response['status'] == false) {
throw new Exception($response);
}

/**
* You'll find the full JSON metadata array within the `$response` variable.
* Remember to always check if the `status` property is set to `true`.
*/

if ($response['status'] == true) {
print ($response['output']['src']);
} else {
print ($response['message']);
}
});
curl -X POST \
https://api.picsmize.com/image/process \
-H "apikey: your-api-key" \
-H "content-type: application/json" \
-d '{
"img_url": "https://www.example.com/image.jpg",
"process": {
"watermark": {
"id": "610ba78772e19003-1628153735"
"fit": true,
"gravity": "top",
"padding": 10,
"opacity": 0.8
}
}
}'
									
										package main

										import (
											"fmt"

											"github.com/picsmize/picsmize-go"
										)

										func main() {

											pics, err := picsmize.Init("your-api-key")
											if err != nil {
												panic(err)
											}
											
											/**
											* Provide a publicly available image URL with fetch(string) method,
											* and apply a watermark ID 610ba78772e19003-1628153735 in the fit to top
											* with 10px padding and 0.8 opacity
											*/

											res, err := pics.Fetch("your-image-url").
												Watermark(picsmize.Options{
													"id": "610ba78772e19003-1628153735",
													"fit": true,
													"gravity": "top",
													"padding": 10,
													"opacity": 0.8,
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

											/**
											* You'll find the full JSON metadata within the `res` variable.
											*/

											fmt.Println(res)
										}
									
								
Resizing An Image Online