Skip to content
This repository has been archived by the owner on Dec 2, 2022. It is now read-only.

Latest commit

 

History

History

imagemin

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

imagemin example

A lightning fast image optimization API, built on top of imagemin for Node.js.

Use Hosted API

Quick Start

Welcome to the quick-start! Below are some examples for common ways of using the API via cURL.

Also be sure to check out the full reference of API endpoints.

Intro

This API is a hosted version of the open source imagemin library. The examples here show how to use the library via an API endpoint.

The following image formats are supported:

  • png
  • jpg / jpeg
  • webp
  • svg
  • gif

Optimizing an image via a URL

Providing an image URL is the easiest way to use this API.

curl --request POST -o optimized.png \
  --url 'https://ssfy.sh/dev/imagemin/optimizeImageUrl' \
  --header 'content-type: application/json' \
  --data '{"url":"https://octodex.github.com/images/original.png"}'
  • Before: 36582 bytes
  • After: 20176 bytes
  • Savings: 45%

All PNG optimizations make a best effort to remain lossless.

Optimizing an image payload

You can also provide binary image data as the body of POST requests. Try replacing the image path with your own local test image.

curl --data-binary '@./examples/test-0.png' -o optimized.png \
  'https://ssfy.sh/dev/imagemin/optimizeImage'

See the following docs for more info on curl's --data-binary option.

  • Before: 71834 bytes
  • After: 29579 bytes
  • Savings: 59%

License

MIT © Saasify