Developer API

Automate your AVIF, WebP, JPEG and PNG compression workflow

Hook up your server to optimize all your AVIF, WebP, JPEG and PNG images on the fly. Join over 50.000 companies and developers around the world who are using the API. Enter your name and email address below to retrieve your key and get started.

Getting started

Once you retrieve your key, you can immediately start shrinking images. Official client libraries are available for Ruby, PHP, Node.js, Python, Java and .NET. You can also use the WordPress plugin to compress your WebP, JPEG and PNG images.

The community has also created a large number of third-party add-ons using the Developer API.

You can also create your own integration with any HTTP(S) client. The server will compress your image and respond with a URL where you can grab the result.

curl --user api:YOUR_API_KEY \
      --data-binary @unoptimized.png -i https://api.tinify.com/shrink

Features

Same API for all image formats

The API compresses AVIF, WebP, JPEG and PNG images. Simply upload your source image and download the optimized result. Everything else happens automatically.

Upload directly or provide a URL to the image

You can either upload images directly or specify a URL to the image you want to compress.

Convert images to AVIF, WebP, JPEG or PNG (new)

Convert your images to another format, or ask the API to give you the smallest image format! Images with a transparent background can be filled with a color you specify.

Preserve metadata

You can choose to preserve copyright information, the GPS location and the creation date in the compressed JPEG images. For PNG images the copyright information can be preserved.

Amazon S3 and Google Cloud Storage (new)

You can instruct the API to save the optimized images directly in your Amazon S3 or Google Cloud Storage buckets. When doing this you may also set custom Cache-Control and Expires headers.

Perfect image resizing

The API can resize your images as well as optimising them. You only have to upload the original once and then generate the image sizes you need. Resizing includes correct gamma scaling, bicubic transparency edge correction and natural image sharpening.

Area of interest detection

Take advantage of smart cropping to create thumbnails with different aspect ratios. The API will resize your images and crop away the parts that are visually the least interesting.

Area of interest detection explained

Original image
upload your original image ...
Arrow
Area of interest detection
... the area of interest is detected ...
Arrow
Image smart resized with API
... image is scaled and cropped

Cut out image detection (new)

We've added a new algorithm to detect free standing objects on plain backgrounds. The API will add background space or remove superfluous areas when the aspect ratio is changed. This way the object in your image will remain free-standing and does not get cut-off at the edges when resizing.

Resizing of cut out images explained

Original cut out image
upload your original image ...
Arrow
API object detection
... the free standing object is detected ...
Arrow
Image with new aspect ratio
... new image size is applied

Pricing

You only pay for what you use. The first 500 compressions each month are free. You will only be billed if you compress more than 500 images.

There are no subscription costs and no minimum fees. Only successful compressions will be charged.

Images uploaded with APIPrice per unit

  • First 500 images per monthfree
  • Next 9 500 image compressions$0.009 per image
  • After 10 000 image compressions$0.002 per image
… or simply calculate your costs

Price calculator

2 000

$13.50total price

When you reach your compression limit the API will return the error message: Your monthly limit has been exceeded. Upgrade your account by entering your payment details on your WordPress & API dashboard.

If you entered your payment details and want to disable using paid compressions, you can limit your account to free compressions at any time on your account page.

Corporate subscriptions

For corporations and large businesses we offer special subscription plans. They come with fixed fees, fair usage policy, priority support and optional yearly bank payment. Contact us at support@tinypng.com.

Documentation

For documentation and code examples in different programming languages you can explore the API Reference.

Try TinyPNG with a new browser

TinyPNG is created for modern browsers with HTML5 & CSS3 support. We have not tried it out in other browsers. The site may work, or it may not. If you see this message you may want to try a different browser!