1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
const axios = require('axios');
const api_key = "YOUR API-KEY";
const url = "https://api.segmind.com/v1/image-resizer";
const data = {
"image_url": "https://i.ibb.co/ZSS2hDV/d9602ae7-ff9b-4d64-b121-a5bd96a7d703.jpg",
"width": 1024,
"height": 1024
};
(async function() {
try {
const response = await axios.post(url, data, { headers: { 'x-api-key': api_key } });
console.log(response.data);
} catch (error) {
console.error('Error:', error.response.data);
}
})();Base64 encoded image data or URL of the image to be resized
Desired width of the resized image
min : 100,
max : 5000
Desired height of the resized image (1-25000 pixels)
min : 100,
max : 5000
To keep track of your credit usage, you can inspect the response headers of each API call. The x-remaining-credits property will indicate the number of remaining credits in your account. Ensure you monitor this value to avoid any disruptions in your API usage.