This service allows you to post an image and receive a compressed and/or modified image as the return object.
Following is a list of parameters that the service accepts. Requests should be sent to http://svc.apprad.us/shrink
using a POST request.
Parameter | Description | Required | Default |
---|---|---|---|
image | Image being processed as an image object reference | Y | n/a |
action | Action which you wish to perform. Available options are: default, hero, icon, avatar, thumbnail | N | default |
filename | Filename which you wish the generated file to be returned with | N | image.png |
Following is a description of each available action
parameter.
New actions can be defined in the file {root}/shrinkage/conf/actions.json
.
Compresses an image and converts to jpeg without altering the dimensions.
- Size: (unchanged),
- Format: jpeg
- Quality: 50
Resizes an image for placement in a hero.
- Size: width: 640, height: 480
- Format: png
- Level: 7,
- Crop: true
Resizes an image for use as an icon.
- Size: width: 50, height: 50
- Format: png
- Level: 7,
- Crop: true
Resizes an image for use as an avatar.
- Size: width: 80, height: 80
- Format: png
- Level: 7,
- Crop: true
Resizes an image for use as a thumbnail.
- Size: width: 250, height: 100
- Format: png
- Level: 7,
- Crop: true
Samples a section from the image.
- Size: width: 150, height: 150
- Format: png
- Level: 4,
- Crop: true
- Extract: top:300, left:100
Inverts the color profile of an image.
- Size: (unchanged)
- Format: png
- Level: 4,
- Invert: true
Rotates an image 90 deg. clockwise
- Size: (unchanged)
- Format: png
- Level: 4,
- Rotate: 90
Rotates an image 180 deg. clockwise
- Size: (unchanged)
- Format: png
- Level: 4,
- Rotate: 180
Rotates an image 270 deg. clockwise
- Size: (unchanged)
- Format: png
- Level: 4,
- Rotate: 270
Mirrors an image vertically.
- Size: (unchanged)
- Format: png
- Level: 4,
- Flip: true
Mirrors an image horizontally.
- Size: (unchanged)
- Format: png
- Level: 4,
- Flop: true
Creates an inverse image that is flipped vertically and horizontally; possibly sends you to the 5th dimension.
- Size: width: 640, height: null
- Format: png
- Level: 5
- Invert: true
- Flip: true
- Flop: true
Actions can be defined using the following available parameters:
Parameter | Description | Required | Default |
---|---|---|---|
size | Object defining the width and height of the resulting image. Either width or height can be made relative by providing the value of "null". Object definition: {w:640,h:"null"} |
N | {} |
format | File format for the generated file. Available options: png jpeg webp raw . |
N | png |
crop | Does the resize option constrain the image, or does it crop the image? Boolean true or false . |
N | false |
extract | Object defining which section of the image to extract. Used in conjunction with resize which sets the physical size of the extracted section. Object definition: {left:0, top:0} . |
N | false |
level | An advanced setting for the zlib compression level of the lossless PNG output format. | N | 6 |
quality | The output quality to use for lossy JPEG, WebP and TIFF output formats. | N | 80 |
rotate | Sets the angle of rotation for the target image. Specify values in positive and negative integers between -360 and 360. | N | false |
invert | Produces the "negative" of the image. White => Black, Black => White, Blue => Yellow, etc. Boolean true or false . |
N | false |
flip | Flip the image on the vertical Y axis. This always occurs after rotation, if any. Boolean true or false . |
N | false |
flop | Flop the image on the horizontal X axis. This always occurs after rotation, if any. Boolean true or false . |
N | false |