Project

zara4

0.0
No commit activity in last 3 years
No release in over 3 years
Zara 4 compresses and optimizes your images
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 0.3.13
~> 1.8
 Project Readme

Ruby SDK

Installation

To install the Zara 4 Ruby SDK gem run:

gem install zara4

Example Usage

require 'zara4'


client = Zara4::API::Client.new({
  'client_id'     => 'YOUR_API_CLIENT_ID',
  'client_secret' => 'YOUR_API_CLIENT_SECRET'
})


#
# RemoteImageRequest
#
original_image = Zara4::API::ImageProcessing::RemoteImageRequest.new('https://zara4.com/img/comparison/beach/original.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 = client.process_image(original_image)
client.download_processed_image(processed_image, 'test/remote.jpg')


#
# LocalImageRequest
#
original_image = Zara4::API::ImageProcessing::LocalImageRequest.new('test/test-images/001.jpg')
processed_image = client.process_image(original_image)
client.download_processed_image(processed_image, 'test/local.jpg')