Image processing
So now we have requred heades set from previous article now we can do image processings
Direct Request
The endpoint for direct image processing https://api.pritset.com/api/image/process/direct/{ops}
Webhook Request
The endpoint for webhook image processing https://api.pritset.com/api/image/process/webhook/{ops}
After request you will receive json object with id of furthure result identification
{
id: '57056f7462084dde8902421e9287ea2d'
}
Webhook call
After image processing finish, your Url endpoint will be called with POST request
| Parameter | Value |
|---|---|
| Body | Processed image |
| Query Id | Unique id which was responded by server with processing request (aka '57056f7462084dde8902421e9287ea2d') |
Common parameters
| Parameter | Value |
|---|---|
| ops | These are parameter from here |
Body
Content type of request must be multipart/form-data
| Parameter | Value |
|---|---|
| file (required for direct, webhook) | This must be a image file you want to adjust |
| url (required for webhook) | Url to your endpoint which will be called after processing |
Image adjust params
Resize
/rs:w:h
| Parameter | Description |
|---|---|
| rs | Resize |
| w | Width an integer |
| h | Heights an integer |
Rotate
/rot:angle
| Parameter | Description |
|---|---|
| rot | Rotate |
| angle | Can use 0, 90, 180, 270 |
Crop
/c:w:h/g
| Parameter | Description |
|---|---|
| c | Crop |
| w | Width an integer > 1 |
| h | Heights an integer > 1 |
| g | Gravity Optional param |
Gravity
/g:sp:xo:yo
| Parameter | Description |
|---|---|
| g | Gravity |
| sp | Start point |
| no: north (top edge) | |
| so: south (bottom edge) | |
| ea: east (right edge) | |
| we: west (left edge) | |
| noea: north-east (top-right corner) | |
| nowe: north-west (top-left corner) | |
| soea: south-east (bottom-right corner) | |
| sowe: south-west (bottom-left corner) | |
| ce: center | |
| x, y | X and Y offset |
Parameters for converting image
/@format
| Parameter | Description |
|---|---|
| format | From Supported converting formats in table below |
Supported converting formats
| Format | Extension | Source | Result |
|---|---|---|---|
| PNG | png | Yes | Yes |
| JPEG | jpg | Yes | Yes |
| WebP | webp | Yes | Yes |
| AVIF | avif | Yes | Yes |
| GIF | gif | Yes | Yes |
| ICO | ico | Yes | Yes |
| BMP | bmp | Yes | Yes |
| TIFF | tiff | Yes | Yes |