How Can We Help You?

Compressing

Picsmize image compressing API minimize image size without affecting its original quality with achieving on average 60% of savings without any impact on the image. The Picsmize Image API gives you the option of selecting a compressing level for various instances. Below, you will find the Picsmize API’s full description of various compressing level : Low, Medium and High. If you’ve tried to upload or use a massive high-resolution image file, you know why image compression is so important. Image formats that use compression make it easy to save images across devices, share or load. Before you convert your files, know what you’re working with in terms of image quality and compression.

Supported image formats:

  • JPEG
  • JPG
  • PNG
  • WEBP
Low

To utilize the Low level compression, you must first set a "level" : "low" in the compress hash.

<?php

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

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

/**
* Provide a publicly available image URL with fetch(string) method,
* compress the image, set compress level to "low"
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->compress(Picsmize::COMPRESS_LOW)
->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": {
"compress": {
"level": "low"
}
}
}'
									
										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,
											* compress the image, set compress level to "low"
											*/

											res, err := pics.Fetch("https://www.example.com/image.jpg").
												Compress(picsmize.Options{
													"level": "low",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

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

											fmt.Println(res)
										}
									
								
Compress The Photo
Images Size Reducer
Resizing Of Image
Medium

To utilize the Medium level compression, you must first set a "level" : "medium" in the compress hash.

<?php

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

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

/**
* Provide a publicly available image URL with fetch(string) method,
* compress the image, set compress level to "medium"
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->compress(Picsmize::COMPRESS_MEDIUM)
->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": {
"compress": {
"level": "medium"
}
}
}'
									
										package main

										import (
											"fmt"

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

										func main() {

											pics, err := picsmize.Init("https://www.example.com/image.jpg")
											if err != nil {
												panic(err)
											}

											/**
											* Provide a publicly available image URL with fetch(string) method,
											* compress the image, set compress level to "medium"
											*/

											res, err := pics.Fetch("your-image-url").
												Compress(picsmize.Options{
													"level": "medium",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

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

											fmt.Println(res)
										}
									
								
Resizing An Image Online
Resizing Pictures
Compress A Png
High

To utilize the High level compression, you must first set a "level" : "high" in the compress hash.

<?php

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

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

/**
* Provide a publicly available image URL with fetch(string) method,
* compress the image, set compress level to "high"
*/

$picsmize
->fetch('https://www.example.com/image.jpg')
->compress(Picsmize::COMPRESS_HIGH)
->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": {
"compress": {
"level": "high"
}
}
}'
									
										package main

										import (
											"fmt"

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

										func main() {

											pics, err := picsmize.Init("https://www.example.com/image.jpg")
											if err != nil {
												panic(err)
											}

											/**
											* Provide a publicly available image URL with fetch(string) method,
											* compress the image, set compress level to "high"
											*/

											res, err := pics.Fetch("your-image-url").
												Compress(picsmize.Options{
													"level": "high",
												}).
												ToJSON()

											if err != nil {
												panic(err)
											}

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

											fmt.Println(res)
										}
									
								
Compress Jpeg
Image Online Resize
Compressor Photo