API Endpoint Access URL
https://api.pixlab.io/randomthreshold
Get Your API Key & Try RANDOMTHRESHOLD Now ↗Description
Generate high-contrast, two-color images by adjusting pixel values based on intensity with the RANDOMTHRESHOLD API endpoint. Ideal for developers and creators seeking advanced image processing. Changes the value of individual pixels based on the intensity of each pixel compared to threshold. The result is a high-contrast, two color image.
HTTP Methods
GET, POST
HTTP Parameters
Required
Fields | Type | Description |
---|---|---|
img |
URL | Input image URL. If you want to upload your image directly from your app, then submit a multipart/form-data POST request. |
low |
Float | The low point. |
high |
Float | The high point. |
key |
String | Your PixLab API Key ↗. You can also embed your key in the WWW-Authenticate: HTTP header and omit this parameter if you want to. |
Optional
Fields | Type | Description |
---|---|---|
blob |
Boolean | By default, this API endpoint returns a JSON Object holding the link to the image output. Set to true to return the image binary contents instead. |
channel |
Integer | Provide any channel constant valid for your channel mode. Combine channel type constants using bitwise operators for multiple channels. |
POST Request Body
Use when submitting POST requests instead of GET:
Allowed Content-Types:
multipart/form-data
application/json
Use multipart/form-data
for direct image uploads (refer to the REST API code samples or The PixLab Github Repository↗ for examples). For JSON, the image must be pre-uploaded. Call store to upload images before invoking this endpoint.
Channels Constant
Fields | Value |
---|---|
CHANNEL_RED |
1 |
CHANNEL_GRAY |
1 |
CHANNEL_CYAN |
1 |
CHANNEL_GREEN |
2 |
CHANNEL_MAGENTA |
2 |
CHANNEL_BLUE |
4 |
CHANNEL_YELLOW |
4 |
CHANNEL_ALPHA |
8 |
CHANNEL_OPACITY |
8 |
CHANNEL_MATTE |
8 |
CHANNEL_BLACK |
32 |
CHANNEL_INDEX |
32 |
CHANNEL_ALL |
134217727 |
HTTP Response
The response will be in application/json
format if the optional blob parameter is not set.
This endpoint returns a JSON Object after each call unless the blob parameter is specified, in which case the image binary contents are returned instead. The following fields are included in the JSON response:
Fields | Type | Description |
---|---|---|
status |
Integer | Status code 200 indicates success, any other code indicates failure. |
link |
URL | Link to the processed image stored on the pixlab.xyz CDN unless custom S3 keys are configured (refer to your dashboard ↗ for configuration). |
id |
String | Unique identifier for the processed image. |
error |
String | Error description when 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...
Similar API Endpoints
quantize, raise, gray, rotate, roll, roundcorners, setorientation, shadow, sepia, transverse, transpose, reverse, reflect, mirror