Normal return
{
"code": 0,
"data": {
"imageBase64: "iVBORw0KGgo..." //base64 encoded of the image
},
"msg": null,
"time": 1590462453264
}
Error
{
"code": 1001, //
"data": null
"msg": 'Insufficient balance',
"time": 1590462453264
}
Dimensions API
Change aspect ratio
Parameter | Type | Description |
---|---|---|
aspectRatio | String | Either of 4:3, 5:4, 16:9, 1:1, 2:1, 3:2, 10:8 |
Sample code
Curl
curl -H 'APIKEY: INSERT_YOUR_API_KEY_HERE' \
-F 'file=@/path/to/file.jpg' \
-F 'aspectRatio=4:3'
-f 'http://localhost:3000/v1/dimensions/changeAspectRatio' \
-o out.png
Python
import requests
payload = dict(aspectRatio='4:3');
response = requests.post(
'http://localhost:3000/v1/dimension/changeAspectRatio',
files={'file': open('/path/to/file.jpg', 'rb')},
data = payload,
headers={'KEY': 'INSERT_YOUR_API_KEY_HERE'},
)
Node.js
const requestOptions = {
method: 'POST',
headers: {
'key': 'INSERT_YOUR_API_KEY_HERE',
'Content-Type': 'application/json'
},
body: JSON.stringify({ title: 'Blur filter', aspectRatio: '4:3' })
};
fetch('http://localhost:3000/v1/api/Blur', requestOptions)
.then(response => response.json())
.then(data => {
console.log(data);
});
1:1 aspect ratio
2:1 aspect ratio
3:2 aspect ratio
4:3 aspect ratio
5:3 aspect ratio
6:4 aspect ratio
7:5 aspect ratio
16:9 aspect ratio
Returning JSON
curl -d "key=<XXX>" -d 'outType=JSON' -d \
...
Returning Download
curl -d "key=<XXX>" -d 'outType=Download' -d \
...
Returning Blob
curl -d "key=<XXX>" -d 'outType=Blob' \
...
Returning Base64
curl -d "key=<XXX>" -d 'outType=Base64' -d \
...
Returning PNG Image
curl -d "key=<XXX>" -d 'outType=Image' -d \
...