Image Processing & Optimization API

Manage your images programmatically with this powerful API: compress, convert, crop, resize, and more.
Get started
↓ Try it for free ↓
Thank you! Your submission has been received!
Oops! Something went wrong while submitting the form.
The world's top engineers and organizations run on Abstract
accenture logonokia logologo cross icongoogle logostanford uni iconpayoneer logo

Why 10,000+ developers love Abstract's APIs

Easy to implement and maintain

We built Abstract because most of the API's we've used in the past simply weren't great. Our APIs are built the way we think API's should be: with excellent documentation, multiple easy to use libraries, and tutorials to get you started.

Speed and scale built into everything we do

Something like IP geolocation is probably part of a critical business processes and flow, so we built it (as all of our APIs) for use at scale and at blazing speeds. These aren't just marketing phrases, but fundamental features of our APIs.

Reliable uptime and great support

Developers trust Abstract because of our reliable uptime and excellent technical support that will help get you live quickly, keep you running smoothly, and resolve any issues you have fast regardless of where you are or what you're building.

The Image Processing & Optimization API helps you manage images programmatically and at scale

Reduce image size, not quality

Abstract's powerful image compression API allows you to reduce the size of your images without sacrificing on image quality or other factors that are important to you and your users.

Powerful infrastructure for top speed

Speed is critical for image processing and great infrastructure is the foundation of speed. So the infra for Abstract's image processing and optimization API is built with from ground up for speed.

Crop, resize, and optimize images

Abstract's Image Processing API comes with a full suite of functionality to programmatically manage images, from cropping to resizing to optimizing and more.

Multiple storage and export options

Abstract's Image Processing API makes it easy to export your optimized images in a number of cloud providers, including AWS S3, Azure, and more.

Speed up your site or app

There are many benefits to optimizing your images, from faster load times and more conversions to lower costs and increased performance in SEO.

Bank-level security for all queries

Abstract's Image Processing API comes with more than speed and features. We also care deeply about security, so all data sent and processed is secured via 256-bit SSL encryption (HTTPS).

Simple, transparent, and cost-effective pricing



no card

  • 100 MB / month
  • 1 request / second




  • 1 GB / month
  • 5 requests / second
  • Commercial use allowed
  • Email support




  • 20 GB / month
  • 25 requests / second
  • Commercial use allowed
  • Premium enriched data
  • Email support




  • 250 GB / month
  • 100 requests / second
  • Commercial use allowed
  • Premium enriched data
  • Chat support
Need more requests, enterprise-grade SLA's, faster response time, or premium data?
Contact us to learn about our Enterprise plan.

Image Processing and Optimization API Documentation


Abstract's Image Processing and Optimization API is a simple yet powerful REST API that is used to convert, compress, or optimization an image that is provided via a URL or via POST to the API itself.


The Image Processing and Optimization API, like all of Abstract's APIs, is organized around REST. It is designed to use predictable, resource-oriented URL's and to use HTTP status codes to indicate errors.


The Image Processing and Optimization API requires all communications to be secured TLS 1.2 or greater.

API Versions

All of Abstract's API are versioned. The Image Processing and Optimization API is currently on Version 1.

Your API Key

Your API key is your unique authentication key to be used to access Abstract's Image Processing and Optimization API. Note that each of Abstract's APIs has a unique API key, so you will need different keys to access the Image Processing and Optimization and Website Screenshot APIs, for example. To authenticate your requests, you will need to append your API key to the base URL.

Base URL

Getting an image to the Image Processing and Optimization API

There are two methods to begin working with an image:
          1. providing the API with a URL of the image
          2. uploading the image directly to Abstract.

Providing the URL is simpler, as you just need to make a simple HTTP POST call with all of the necessary data in the payload as JSON.

Option 1 - Uploading an image to the API via URL

To upload an existing image via URL, you will make an HTTP POST call to the following URL:

To use the API with a direct upload, you must make a multi-part HTTP POST (content type multipart/form-data). The base URL for this is




api_key required


Your unique API key. Note that each user has unique API keys for each of Abstract's APIs, so your Image API key will not work for as your User Avatar API key, for example.

url required


The URL of the image that you would like to edit. Note that is cannot be more than 32 MB in size.

Option 2 - Uploading an image to the API directly

To use the API with a direct upload, you must make a multi-part HTTP POST (content type multipart/form-data). The base URL for this is

The image should be uploaded as a file named "image", and the rest of the data should be json data uploaded with the name "data". The "data" argument should contain all the information from above EXCEPT the URL param which is not needed. Here's an example using curl:

curl \
--form data='{api_key": "your-api-key", "lossy": true}' \
--form image=@path/to/image/file.jpg

Return data is in JSON format:

   "original_size": "the size of the original input image, in bytes",
   "original_height": "original height in pixels of the image",
   "original_width": "original width in pixels of the image",
   "final_size": "the size of the new image, in bytes",
   "bytes_saved": "the number of bytes saved by compressing and resizing the image",
   "final_height": "final height in pixels of the image",
   "final_width": "final width in pixels of the image",
   "url": "url of the image hosted by abstract for you to download. Images are available for 1 day.",

Image Processing and Optimization API - Request Parameters

The Image Processing and Optimization API has 3 main functionalities, which can be used separately or independently as parameters on the request. These functionalities are:






If true, the API will perform a lossy compression on the image, reducing the size massively with a small drop in image quality. If false, the image size will only be reduced slightly (10% - 20% at most), but there will be no reduction in image quality. The default value is false if this is not provided.



This is an integer between 0 and 100 that determines the quality level for lossy compression. If not submitted it will be determined intelligently. Use only if you know what you are doing. Generally a quality above 95 is useless and may result in an image that is larger than the input image, and a quality below 25 will result in an image so low in quality that it will be useless.



This is a set of JSON data that will determine how to resize the image. If not provided, we will only compress the image as desired.

Options for "resize" parameter

The resize parameter takes a set of JSON data that determines how to resize the image. That JSON data can contain one or many of the following resizing strategies:

exact : Resize to exact width and height. Aspect ratio will not be maintained

"resize": {
     "width": 100,
     "height": 75,
     "strategy": "exact"

portrait : Exact height will be set, width will be adjusted according to aspect ratio

"resize": {
     "height": 75,
     "strategy": "portrait"

landscape : Exact width will be set, height will be adjusted according to aspect ratio

"resize": {
     "width": 100,
     "strategy": "landscape"

auto : The best strategy (portrait or landscape) will be selected according to its aspect ratio

"resize": {
     "width": 100,
     "height": 75,
     "strategy": "auto"

fit : This option will crop and resize the image to fit the desired width and height.

"resize": {
     "width": 100,
     "height": 75,
     "strategy": "fit"

crop : This option will crop an image to the exact size you specify. The resulting cropped image can optionally be scaled by inclusion of a scale, which accepts a number representing the percentage by which the image should be scaled.

If you want to crop from a direction other than the default "center", you can specify a crop_mode parameter, which can take one of the following gravity (or direction) values:
n or t - North / Top
nw or tl - North West / Top Left
ne or tr - North East / Top Right
w or l - West / Left
c - Center - this is the default gravity or direction, and applied when the crop_mode parameter is left out, or an invalid value is passed.
e or r - East / Right
se or br - South East / Bottom Right
sw or bl - South West / Bottom Left
s or b - South / Bottom
Please note that the crop_mode parameter can be used with both the fit and the crop strategies.
If you would like to crop a custom area from an image, you can do so by specifying the rectangular region you wish to extract as x, y, width and height. Optionally, you can pass a scale parameter (as mentioned above), which must be a number representing the percentage by which you would like to scale the image.

"resize": {
     "width": 100,
     "height": 75,
     "strategy": "crop",
     "scale": 50,
     "crop_mode": "c",

square : This strategy will crop the image by its shorter dimension to make it a square, then resize it to the specified size.

"resize": {
     "size": 100,
     "strategy": "square"

fill : This strategy allows you to resize the image to fit the specified bounds while preserving the aspect ratio. The optional background property allows you to specify a color which will be used to fill the unused portions of the previously specified bounds.  The background property can be formatted in HEX notation #f60 or #ff6600 or RGB rgb(255, 0, 0). The default background color is white.

"resize": {
     "width": 100,
     "height": 75,
     "strategy": "fill",
     "background": "rgb(91, 126, 156)"

Response and Error Codes

Whenever you make a request that fails for some reason, an error is returned also in the JSON format. The errors include an error code and description, which you can find in detail below.






Everything worked as expected.


Bad request

Bad request



The request was unacceptable. Typically due to the API key missing or incorrect.


Internal Server Error

The request could not be completed due to an error on the server side.


Service Unavailable

The server was unavailable.

Frequently Asked Questions
about Image Processing & Optimization API

What is an Image Processing & Optimization API?

An Image Processing & Optimization API provides a set of tools for a user to manipulate an image programatically. This can include but is not limited to reducing the image size, changing the image's dimensions, and more.

What are the benefits to Image Processing & Optimization?

Image optimization has many technical, user experience, and economic benefits. First, programatic image processing such as through Abstract's API makes it easy for you to get images in a format that you require. Second, more optimized images are often smaller in size and load faster, and so result in a faster experience for users and overall a better user experience. And last, smaller images means less storage and lower costs. It's a win win win!

What's the trade off between size and quality in image optimization?

There are certainly trade offs to make between an image's size and its quality. The smaller an image is, the less quality it has, all things being equal. However, Abstract's Image Processing and Optimization API's are designed to reduce size without affecting quality too much. The trade offs between these two are also fully configurable in the API, so if you don't like the API's default settings, you can always change it.

Developers love Abstract's Image Processing and Optimization API

We saved several thousand dollars a month from switching to Abstract's image API. The savings were more or less immediate since it was so easy to integrate. I think this is a no brainer for anyone working with lots of images.

Matt N.

Our team was struggling with a ton of different image formats, sizes, etc until we came across Abstract and began working with the Image Processing API. It's saved us a bunch of time and now we can actually focus on the core parts of our business!

Christophe L.

Needless to say we're not experts in image optimization but thankfully we can just outsource that to Abstract. We love working with the team and really appreciate the fast technical support as well. Keep it up and thanks :)

Sam S.

Image Processing and Optimization API Changelog

Last Updated on 

November 18, 2020

November 18, 2020


Updated documentation with new crop strategies

July 8, 2020


Improved compression and optimization flows to improve quality and reduce speed


Get FREE credits to start today.

Get thousands of API calls for free across all Abstract APIs.

Frequently Asked Questions
About Subscription & Pricing

What does the API cost?

Each of our API's has a free plan as well as several paid options, which offer a greater number of requests, a higher level of data quality, and greater speed for higher prices. Please see the page above or sign into your account to view pricing for each API.

Do you have a free trial or free options for your API's?

Absolutely! We want you to try before you buy. Each of our API's has a free tier with a generous usage allowance for you to try the product out and verify that the speed and data quality work for you.

What payment options do you offer?

We use Stripe to accept payment via major debit and credit cards (Visa, Mastercard, American Express). If you cannot use those payment methods, then contact us at team at to arrange for an alternative payment method.

Can I upgrade or downgrade my subscription?

Yes, you can upgrade or downgrade your subscription at any time by visiting your dashboard. If you upgrade in the middle of a billing cycle, you will be charged a pro-rated amount for your new plan through the end of the billing cycle.

Can I cancel at any time?

Yes, all of our subscriptions are month to month. You can cancel at any time, and you will not be charged again at the end of your billing cycle.

How can I cancel my subscription?

You can cancel your subscription at any time from your dashboard. Once canceled, your subscription will be active until the end your current billing cycle, and then it will be automatically moved to the free plan.

What happens if I go over my monthly quota for requests?

If your API usage exceeds the monthly limit set by your plan, then you will be charged a fee for each call over your limit. At the end of your billing period, your usage will reset again.

What if I need more requests or something else that's not offered in your plans?

We do offer enterprise plans with custom features and pricing in limited circumstances. If our public pricing plans don't work for you, then contact us (team at and we'll work something out.

Do you offer any discounts?

While we don't normally offer discounts, we do make exceptions for certain types of users and use cases. If you are a student or are engaged in academic work, or are working on a non-profit or open source project, we're happy to offer you discounts for our API's. Just email us at team at

Do you offer discounts for annual or quarterly payments?

All of our plans are currently paid month to month. We will be launching annual plans at a discount soon. If you're interested in an annual plan in the meantime, just contact us and we'll set you up.

What happens if my payment method expires?

We will typically attempt to charge your payment method up to three times after it fails. If we're still unable to collect payment, then your subscription will be automatically canceled and you'll be moved to the free plan.

Can I use the API's for a commercial project?

Yes, a paid tier of our API may be used in conjunction with a commercial project. The free tiers of our API's may not be used in commercial projects.