POST /v1/image/crophttps://api.cludz.net/v1/image/crop
Crop a rectangular region from an uploaded image.
Body Parameters (FormData):
| Parameter | Required | Description | Type |
|---|---|---|---|
image | Yes | The image file. | file |
left | Yes | Left offset (x-coordinate). | number |
top | Yes | Top offset (y-coordinate). | number |
width | Yes | Width of the crop area. | number |
height | Yes | Height of the crop area. | number |
curl -X POST "https://api.cludz.net/v1/image/crop" \
-H "Authorization: Bearer YOUR_API_KEY" \
-F "image=@/path/to/image.jpg" \
-F "left=100" \
-F "top=100" \
-F "width=200" \
-F "height=200" \
--output crop.jpg
const formData = new FormData();
formData.append('image', fileInput.files[0]);
formData.append('left', '100');
formData.append('top', '100');
formData.append('width', '200');
formData.append('height', '200');
const res = await fetch('https://api.cludz.net/v1/image/crop', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
body: formData
});
const blob = await res.blob();
const formData = new FormData();
formData.append('image', fileInput.files[0]);
formData.append('left', '100');
formData.append('top', '100');
formData.append('width', '200');
formData.append('height', '200');
const res = await fetch('https://api.cludz.net/v1/image/crop', {
method: 'POST',
headers: { 'Authorization': 'Bearer YOUR_API_KEY' },
body: formData
});
const blob = await res.blob();
import requests
url = "https://api.cludz.net/v1/image/crop"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
files = {"image": open("/path/to/image.jpg", "rb")}
data = {"left": "100", "top": "100", "width": "200", "height": "200"}
response = requests.post(url, headers=headers, files=files, data=data)
with open("crop.jpg", "wb") as f:
f.write(response.content)
Returns the cropped image file directly.