API Endpoint Access URL
https://api.pixlab.io/drawrectangle
Get Your API Key & Try DRAWRECTANGLE Now ↗Description
Draw a single rectangle on a given image. This API endpoint is depreciated in favor of drawrectangles (with S) which permit drawing as much rectangles as desired on the input image especially if mixed with facedetect to mark detected faces.
HTTP Methods
GET, POST
HTTP Parameters
Fields | Type | Description |
---|---|---|
img |
URL | Input image URL. For direct uploads, submit a multipart/form-data POST request. |
x |
Integer | X coordinate of the top left corner. |
y |
Integer | Y coordinate of the top left corner. |
width |
Integer | Width of the rectangle. |
height |
Integer | Height of the rectangle. |
key |
String | Your PixLab API Key ↗. Alternatively, use WWW-Authenticate: HTTP header. |
Optional
Fields | Type | Description |
---|---|---|
blob |
Boolean | Returns image binary content when true (default: JSON response). |
color |
String | Border color (default: white ). Hex codes supported (e.g., #cef45f ). |
fillcolor |
String | Fill color (default: transparent). Hex codes supported. |
strokewidth |
Float | Border width (default: 1.2). |
strokeopacity |
Float | Border opacity (default: 0.9). |
POST Request Body
Supported Content-Type:
multipart/form-data
application/json
Use multipart/form-data
for direct image uploads (see samples). For JSON, ensure the image is hosted elsewhere. Upload via store if needed.
Pro tip: For advanced use cases, prefer drawrectangles.
HTTP Response
Fields | Type | Description |
---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
link |
URL | Link to the image output which is usually stored on the pixlab.xyz storage server unless you set your own S3 keys (refer to your dashboard ↗ on how to do that). |
id |
String | Unique image ID. |
error |
String | Error message if status != 200. |
Code Samples
# Refer to the PixLab Github Repository at: https://github.com/symisc/pixlab for the full list of production ready code samples...
// Refer to the PixLab Github Repository at: https://github.com/symisc/pixlab for the full list of production ready code samples...
# Refer to the PixLab Github Repository at: https://github.com/symisc/pixlab for the full list of production ready code samples...
# Refer to the PixLab Github Repository at: https://github.com/symisc/pixlab for the full list of production ready code samples...