Image Operations / Filtering
The Optidash Image API provides you with a powerful toolbelt of the highest quality filters you can apply on your images - from multiple modes of image blurring through sepia, duotone, monochrome or halftone to color replacement. You may of course stack as many different filters toghether as you like.
All filtering parameters must be passed within a filter
hash and every filter, at minimum, accepts a value
which takes a positive float within the range 0
- 100
. For example, to apply a pixellate filter:
{
"filter": {
"pixellate": {
"value": 10
}
}
}
An example cURL request with Image Fetch method of applying a pixellate filter will look like the following:
curl https://api.optidash.ai/1.0/fetch
--user your-api-key: \
--header "Content-Type: application/json" \
--data '{
"url": "https://www.website.com/image.jpg",
"filter": {
"pixellate": {
"value": 10
}
}
}'
Using Multiple Filters
As previously mentioned, you can stack different filters together. To do so, simply add additional filters within the filter
hash. For example, to apply a Sepia Tone filter together with Gaussian Blur:
{
"filter": {
"sepia": {
"value": 10
},
"blur": {
"mode": "gaussian",
"value": 10
}
}
}
Duotone
This extremely artistic filter maps two input colors onto the darks and lights of an image. The resulting image is represented only with the shades of the two input colors.
The Duotone filter takes two parameters: light
and dark
which are color values to map onto the grayscaled input image. Both parameters take a color value as hex-encoded string in RGB
or RRGGBB
format.
{
"filter": {
"duotone": {
"light": "6AFF7F",
"dark": "00007E"
}
}
}
Gaussian Blur
This is one of the most widely used blurring algorithms. It blurs pixels by applying a convolution kernel which mixes in a fraction of the color of neighboring pixels. This will cause sharp color transitions to appear more gradual and results in a softness or blur of the image.
In order to use the Gaussian Blur filter, you must set the blur
filter mode
to gaussian
and set a value
which takes a float within the range 0
- 100
, and describes the amount of blur applied to the input image.
{
"filter": {
"blur": {
"mode": "gaussian",
"value": 10
}
}
}
Sepia Tone
Modifies the color of each pixel within the image in a way that they fall into redish-brown tones.
In order to use the Sepia Tone filter, you must set a value
within the sepia
hash which takes a float within the range 0
- 100
, and describes the amount of brown shading applied to the image.
{
"filter": {
"sepia": {
"value": 10
}
}
}
Pixelate
Pixelates the image by mapping the image to colored squares whose color is defined by the average of the replaced pixels.
In order to use the Pixellate filter, you must set a value
within the pixellate
hash which takes a float within the range 0
- 100
, and describes the size of image pixelation.
{
"filter": {
"pixellate": {
"value": 10
}
}
}
Monochrome
Remaps the color of each pixel within the image so that it falls within the shades of a single color.
In order to use the Monochrome filter, you must set a value
within the monochrome
hash which takes a float within the range 0
- 100
, and describes the intensity of the applied monochromatic hue and a color
which takes a hex-encoded string in RGB
, RRGGBB
or AARRGGBB
format. For example, to apply a semi-transparent blue 750015FF
hue:
{
"filter": {
"monochrome": {
"value": 10,
"color": "750015FF"
}
}
}