Options
You can customise how your images are processed with Zara 4 by altering your request options.
Available Options
optimisation-mode —
|
This indicates the level of compression you want to perform.
Available options: highest, compromise, lowest
|
colour-enhancement —
|
This indicates what colour enhancement you want to perform.
Available options: none, improve-colour, dingy-room
|
resize-mode —
|
This indicates what how you want the image to be resized.
Available options: none, stretch, crop, web-bundle
|
width —
|
The width you want the image to be resized to.
(Only applies for stretch, crop resize modes)
|
height —
|
The height you want the image to be resized to.
(Only applies for stretch, crop resize modes)
|
Example usage
// Import Zara 4 classes
use Zara4\API\Client;
use Zara4\API\ImageProcessing\LocalImageRequest;
// ...
$apiClient = new Client("API_CLIENT_ID", "API_CLIENT_SECRET");
$originalImage = new LocalImageRequest("/path/to/original-image.jpg");
// Change request options
$originalImage->optimisationMode = OptimisationMode::HIGHEST;
$originalImage->outputFormat = OutputFormat::MATCH;
$originalImage->colourEnhancement = ColourEnhancement::IMPROVE_COLOUR;
$originalImage->resizeMode = ResizeMode::NONE;
$processedImage = $apiClient->processImage($originalImage);
$apiClient->downloadProcessedImage($processedImage, "/where/to/save/compressed-image.jpg");
// Import Zara 4 classes
import com.zara4.api.*;
// ...
Client apiClient = new Client("API_CLIENT_ID", "API_CLIENT_SECRET");
LocalImageRequest originalImage = new LocalImageRequest("/path/to/original-image.jpg");
// Change request options
originalImage.optimisationMode = OptimisationMode.HIGHEST;
originalImage.outputFormat = OutputFormat.MATCH;
originalImage.colourEnhancement = ColourEnhancement.IMPROVE_COLOUR;
originalImage.resizeMode = ResizeMode.NONE;
ProcessedImage processedImage = apiClient.processImage(originalImage);
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg");
# Import Zara 4 classes
require 'zara4'
# ...
api_client = Zara4::API::Client.new({
'client_id' => 'API_CLIENT_ID',
'client_secret' => 'API_CLIENT_SECRET'
})
original_image = Zara4::API::ImageProcessing::RemoteImageRequest.new('https://example.com/original-image.jpg')
original_image.optimisation_mode = Zara4::API::ImageProcessing::OptimisationMode::HIGHEST
original_image.output_format = Zara4::API::ImageProcessing::OutputFormat::MATCH
original_image.colour_enhancement = Zara4::API::ImageProcessing::ColourEnhancement::IMPROVE_COLOUR
original_image.resize_mode = Zara4::API::ImageProcessing::ResizeMode::CROP
original_image.width = 250
original_image.height = 250
processed_image = api_client.process_image(original_image)
api_client.download_processed_image(processed_image, '/where/to/save/compressed-image.jpg')
NODEJS CODE
PYTHON CODE
'Import Zara 4 classes'
Imports Zara4.API
Imports Zara4.API.ImageProcessing
'...'
Dim apiClient = new Client("API_CLIENT_ID", "API_CLIENT_SECRET")
Dim originalImage = New LocalImageRequest("/path/to/original-image.jpg")
'Change request options'
originalImage.optimisationMode = OptimisationMode.HIGHEST
Dim processedImage = apiClient.processImage(originalImage)
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg")
// Import Zara 4 classes
using Zara4.API;
using Zara4.API.ImageProcessing;
// ...
Client apiClient = new Client("API_CLIENT_ID", "API_CLIENT_SECRET");
LocalImageRequest originalImage = new LocalImageRequest("/path/to/original-image.jpg");
// Change request options
originalImage.optimisationMode = OptimisationMode.HIGHEST;
originalImage.outputFormat = OutputFormat.MATCH;
originalImage.colourEnhancement = ColourEnhancement.IMPROVE_COLOUR;
originalImage.resizeMode = ResizeMode.NONE;
ProcessedImage processedImage = apiClient.processImage(originalImage);
apiClient.downloadProcessedImage(processedImage, "/where/to/save/compressed-image.jpg");
Options
When submitting an image processing request you can alter how your image is optimised using a number of options. All parameters are optional and the default values will used if you do not specify a value.
| Option | Value |
|---|---|
optimisation-mode
|
highest - Highest level of compression (smallest file).compromise - Middle level of compression.lowest - Lowest level of compression (largest file). |
colour-enhancement
|
improve-colour - Improve the colour of the image.dingy-room - Correct colour for an image of a dingy room.none - No colour correction. |
resize-mode
|
stretch - Stretch to fit the given width and heightcrop - Crop to fit the given width and heightbundle - A selection of resized images and thumbnails.none - Do not resize the image. |
width
|
null - No width1 to 100000 |
height
|
null - No height1 to 100000 |