Image formatting service
# Image Manipulation Service This service lets you manipulate images that you upload or already have on [Amazon S3](https://aws.amazon.com/s3/) with ImageMagick and can be used at scale, right away. ## Usage ### File Upload ``` const fs = require('fs'); const lib = require('lib'); const file = fs.readFileSync('./image-file.png'); lib.utils.image.format(file, { resize: [300, 200], flip: true }, (err, convertedImage) => { }); ``` ### AWS S3 ``` const lib = require('lib'); const utils = lib.utils({ S3_ACCESS_KEY_ID: 'S3_ACCESS_KEY', S3_SECRET_ACCESS_KEY: 'S3_SECRET_ACCESS_KEY', S3_BUCKET: 'S3_BUCKET', S3_REGION: 'S3_REGION', }); utils.image.format({ key: 's3-file-path/file.png', resize: [200, 300], charcoal: 1 }, (err, convertedImage) => { }); ``` ## Supported Functions The service supports all the manipulation functionality on the GraphicsMagick module, which are [listed here](http://aheckmann.github.io/gm/docs.html#manipulation). For functions that have multiple arguments, pass in an array. For example, the resize function accepts two arguments: ``` ... lib.utils.image.format(file, { resize: [320, 320] }, ...) ``` If you are using the function using HTTP (Note: not recommended in production!) then you can pass in the arguments as a comma-separated string: `https://utils.stdlib.com/image/format?resize=300,300&...` ## Format You can pass in a `format` keyword argument to change the default `PNG` format to `JPG`, `GIF`, or `BMP`. If you want the response to be in `base64`, you can pass in `base64: true` as a keyword argument.
  Published by jacoblee on Wednesday, March 8th, 2017, 8:46:33 PM
This service has 1 function
  format default function
 per request
 per second
  Format Images (by uploading a file or from AWS)
[0] file – ignored if AWS credentials are given. Credentials can be set via S3_ACCESS_KEY_ID S3_SECRET_ACCESS_KEY S3_REGION and S3_BUCKET keys.
   Keyword Arguments
[arguments for ImageMagick] a comprehensive list can be found here: https://github.com/aheckmann/gm#methods under 'manipulation'
base64 set to true if you'd like to receive the result in base64 instead of binary format.
format Image format. Default is PNG. Allowed are: PNG, JPG, GIF, BMP.
key AWS object key – ignored if no AWS credentials are provided.