Abraia Python SDK
Project description
Abraia API client for Python
Python client for the Abraia API, used to smartly transform and optimize (compress) images on-line. Read more at https://abraia.me/docs.
Optimize images for Web with no quality damage based on perception-driven technology.
- Optimal image compression with our perceptual adjustment to preserve the quality and maximize the compression.
- Smart crop and resize images with our saliency and aesthetic based model which balances between content and aesthetics.
abraia optimize --width 800 --height 400 https://images.pexels.com/photos/700948/pexels-photo-700948.jpeg images/skater.jpg
The example takes an image by Willian Was from Pexels with a size of 4865x3321 pixels and a weight of 10.1MB and automatically generates a header of 800x400 pixels cropping, resizing, and optimizing the image to directly be used on Web.
Installation
The Abraia python client works in Windows, Mac, and Linux with Python 2 and 3 (python>=2.6.5).
Install the API client and the CLI with a simple command:
pip install -U abraia
Verify that the abraia CLI is correctly installed:
abraia --version
Configuration
For configuration you just need to create a free account and introduce the API KEYS using the command bellow:
abraia configure
Usage
API usage:
The fluent design of the Abraia API makes easy to compress and transform images. You just need to define the source of the image, the transformation operation, and the sink for the resultant image.
import abraia
abraia.from_file('images/lion.jpg').resize(
width=600, height=600).to_file('images/lion_600x600.jpg')
abraia.from_url('https://abraia.me/images/random.jpg').resize(
width=600, height=400).to_file('images/random_600x400.jpg')
CLI usage:
With the CLI tool you can compress and optimize all the images in a folder with a simple command:
abraia optimize images
Or you can resize and automatically crop all your images and folders, just adding the image size parameters:
abraia optimize --width 500 images/lion.jpg images/resized.jpg
abraia optimize --width 333 --height 333 images/lion.jpg images/cropped.jpg
License
This software is licensed under the MIT License. View the license.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file abraia-0.2.13.tar.gz
.
File metadata
- Download URL: abraia-0.2.13.tar.gz
- Upload date:
- Size: 5.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e1220c522ee80ab0554bd8c2fb1a788f352329b7f33b9041b5b012d1b686237 |
|
MD5 | d63ae4e16ea793176005533291014a1e |
|
BLAKE2b-256 | 82ad436346443c9cbc38bdb32ec4b80695e03ecc2262010c65f4a2cbb03249dd |
File details
Details for the file abraia-0.2.13-py2.py3-none-any.whl
.
File metadata
- Download URL: abraia-0.2.13-py2.py3-none-any.whl
- Upload date:
- Size: 6.3 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee54145845883eeb5e73ebdb990377416bf3d3099cd4121c29ef15497c445bf6 |
|
MD5 | 55c8d0ed0922c0be4713371bfb50cae5 |
|
BLAKE2b-256 | af751b4655328c271ca44f5aaabc39059d5baf9e6f8bbd734b888c3023a7330d |