API Endpoint Access URL
https://api.pixlab.io/drawline
Get Your API Key & Try DRAWLINE Now ↗Description
Draw a single line on a given image. This API endpoint is depreciated in favor of drawlines (with S) which permit drawing as much lines as desired on the input image.
HTTP Methods
GET, POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
img |
URL | Input image URL. If uploading directly from your app, submit a multipart/form-data POST request. |
startx |
Integer | Starting X coordinate. |
starty |
Integer | Starting Y coordinate. |
endx |
Integer | Ending X coordinate. |
endy |
Integer | Ending Y coordinate. |
key |
String | Your PixLab API Key ↗. Can also be embedded in the WWW-Authenticate: HTTP header. |
Optional
Fields | Type | Description |
---|---|---|
blob |
Boolean | Returns image binary contents when true (default: JSON with output URL). |
color |
String | Line color (default: white ). Supports hex codes like #cef45f . |
strokewidth |
Float | Line stroke width (default: 2). |
strokeopacity |
Float | Line stroke opacity (default: 0.9). |
POST Request Body
Allowed Content-Types:
multipart/form-data
application/json
Use multipart/form-data
for direct image uploads (see REST API code samples). For JSON, the image must be pre-uploaded (use store before invocation).
Pro tip: For advanced use cases, consider drawlines instead.
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. |
The API returns application/json
if the optional blob parameter is not set.
This endpoint returns a JSON Object after each call only if the optional blob parameter is omitted. Otherwise, the raw image binary is returned. The JSON response structure is documented above.
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...
Similar API Endpoints
drawrectangles, drawcircles, drawtext, drawpoints, drawtextat