To the Top

Image Compressors (API)

Buy Me A Coffee

Free APIs to optimize your images so that they are loaded faster on the Web!

Images Supported

JPEG/JPG, BMP, GIF, PNG

Get Access Tokens

You would need to get the access tokens first. You can do it by using the following command:
curl -X POST -d "email=dr.zhihua.lai [AT] gmail.com" "https://helloacm.com/api/get-access-token/"
Make sure you replace with your own email. The access tokens will be sent to your email box. You can also specify the parameter reset to force resetting the SECRET token.
Alternativel type in Email:

Check Access Tokens

/api/images-compressor/check parameters - KEY and SECRET.
Example:
curl -X POST -d "key=YOUR-KEY" -d "secret=YOUR-SECRET" "https://helloacm.com/api/images-compressor/check/"
Possible return:

Upload Images and Compress Them

Once you have the APP_KEY and APP_SECRET (will be in the email), then you can use the following to upload:
curl -X POST -F 'file=@test.jpg' -F 'key=YOUR_KEY' -F 'secret=YOUR-SECRET' 'https://helloacm.com/api/images-compressor/'
You can also give parameter m (range from 0 to 100) indicating the optimization level. On sucess, if you return something like this:
{"result":{"id":"25","key":"0cdadf488169697a6293dcbf1f9e9356","ts":"2016-01-29 03:13:07","original":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg.original.jpg","optimize":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg","expirydate":"2016-02-29 03:13:07","quality":"95","original_size":"274092","optimize_size":"274092"},"errCode":0}
The optimized URL will be given in the field optimize.
Possible error codes:
  1. Sucess - in this case upload succesful, check the field of id, key, ts (timestamp), original, optimize, expirydate (default 30 days), quality, original_size, optimize_size.
  2. Invalid quality parameter m given
  3. Require Key and Secret
  4. Access Denied
  5. Invalid Image Type
  6. Invalid Image Size
  7. Upload Rate Limit (1 second per upload)
  8. URL error
  9. Runtime Error
You can specify the URL instead of file as well: curl -X POST -F 'url=URL' -F 'key=YOUR_KEY' -F 'secret=YOUR-SECRET' 'https://helloacm.com/api/images-compressor/'

Strip Comments/Exif from JPEG

When given JPEG/JPG files, you can also specify the parameter exif which is an integer of all following combinations (default = --strip-all):
/*
  BIT 1  --strip-all       strip all (Comment & Exif) markers from output file
  BIT 2  --strip-com       strip Comment markers from output file
  BIT 4  --strip-exif      strip Exif markers from output file
  BIT 8  --strip-iptc      strip IPTC markers from output file
  BIT 16 --strip-icc       strip ICC profile markers from output file
*/
  $exif_s = '';
  if (($exif & 1) > 0) $exif_s .= ' --strip-all';
  if (($exif & 2) > 0) $exif_s .= ' --strip-com';
  if (($exif & 4) > 0) $exif_s .= ' --strip-exif';
  if (($exif & 8) > 0) $exif_s .= ' --strip-iptc';
  if (($exif & 16) > 0) $exif_s .= ' --strip-icc';    

Upload Rate Limit

Since this is totally free and I am paying for the VPS server (and it is quite expensive). Reasonable Rate-Limit is imposed on the upload. Currently, there are two rate-limits:
  1. Each App & Key can only upload maximum 1 image per second
  2. Each IP can only upload maximum 1 image per second

Donations

If you find this useful, and would like to buy me a coffee, :)

PHP Library

Available at github. Example usages:
$obj = new Optimizer("$app_key", "$app_secret");
$response = $obj->optimize("/var/www/imagerecycle/test.jpg");
echo ($response->errCode);
echo ($response->result->optimize); 

List All Images

curl -X POST  -F 'key=YOUR_KEY' -F 'secret=YOUR_SECRET' 'https://helloacm.com/api/images-compressor/list/'
This will return something like this:
[{"id":"25","0":"25","ts":"2016-01-29 03:13:07","1":"2016-01-29 03:13:07","original":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg.original.jpg","2":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg.original.jpg","optimize":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg","3":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg","expirydate":"2016-02-29 03:13:07","4":"2016-02-29 03:13:07","quality":"95","5":"95","original_size":"274092","6":"274092","optimize_size":"274092","7":"274092"}]

List A Image by ID

curl -X POST  -F 'key=YOUR_KEY' -F 'secret=YOUR_SECRET' -F 'id=IMAGE_ID' 'https://helloacm.com/api/images-compressor/list/'
This will return something like this:
[{"id":"25","0":"25","ts":"2016-01-29 03:13:07","1":"2016-01-29 03:13:07","original":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg.original.jpg","2":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg.original.jpg","optimize":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg","3":"https:\/\/helloacm.com\/upload\/images\/0cdadf488169697a6293dcbf1f9e9356\/33be0e6e19abcbec9a605c01ed559a68.jpg","expirydate":"2016-02-29 03:13:07","4":"2016-02-29 03:13:07","quality":"95","5":"95","original_size":"274092","6":"274092","optimize_size":"274092","7":"274092"}]

Delete Image(s)

You can invoke API like this to delete image(s):
curl -X POST  -F 'key=YOUR_KEY' -F 'secret=YOUR_SECRET' -F "id=ID" 'https://helloacm.com/api/images-compressor/delete/'
If ID is not specified -
{"result":"Images ID missing - specify 0 to delete everything","errCode":2}
Specify ID = 0 to delete all images. Possible Error Codes:
  1. Deleted
  2. Require KEY and SECRET
  3. ID parameter missing
  4. Not Found

Share: List of Many Other Online Tools