Skip to content
Node.js client for the Abraia API
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.

Npm Version Build Status Coverage Status

Abraia API client for Node.js

Node.js client for Abraia services. It is used to smartly optimize images for web. Every image is analyzed to choose the best image compression parameters for ecommerce and web optimization (best image quality with the minimal files size).


Install the API client:

npm install --save abraia

Get your free API key and set the ABRAIA_KEY environment variable every time you start a terminal/console session. On Windows, use set instead of export.

export ABRAIA_KEY=your_api_key

For a persistent configuration use your system options to set your ABRAIA_KEY.

Optimizing images

Using the fluent API, to optimize your images you just need to specify the input and output file name, and the image will be smartly optimized for a web best performance.

const abraia = require('abraia/abraia')


For instance, the previous code significantly reduces the JPEG image file size from 470kB to 264kB using our content-aware compression algorithm.

You can also optimize PNG, GIF and WebP images, or convert them from one format to another just changing the file name extension.


PNG jaguar PNG8 jaguar JPEG jaguar

This automatically optimizes the PNG image from 45KB to 15.8KB or convert it to JPEG (14.1KB) with a white background replacing the transparent one.

Resizing and cropping images

Moreover, Abraia services implement high quality resize and smart cropping options. You can automatically resize and crop your images just specifying the demanded image size.

  .resize({ width: 333, height: 333 })

Resized tiger image Smart cropped tiger

Tiger image smart cropped to a square of 333x333 pixels

For a typical image resizing you just need to specify the width or the height of the final image.

  .resize({ height: 333 })

Resized tiger image

Tiger image resized to a height of 333 pixels


This software is licensed under the MIT License. View the license.

You can’t perform that action at this time.