Content Aware Resize

No algorithm description given

Table of Contents Introduction I/O Examples credits Algorithm Console Introduction This algorithm discovers the most important features of an image and attempts to preserve them when resizing. It does this by utilizing both both the face detection and Salnet algorithms to determine importance, and using opencv to directly crop and resize the image. I/O Input { "image":String, "output":String, "width":Int, "height":Int, "raio":Float, "binarize":Boolean } image - (required) - an input image as either a url, data connector uri ( data://, s3://, etc) or a base 64 encoded string. output - (optional) - the output data connector path to where you want to save the resized image to. defaults to data://.algo/temp/<uuid>.png width - (optional) - the desired resize width. defaults to 188 height - (optional) - the desired resize height. defaults to 265 ratio - (optional) - the weighted ratio between the effects of Saliency and Face recognition on the final centroid. A value of 0.0 means the result will entirely depend on saliency, whereas a value of 1.0 will entirely depend on face detection. Here's the exact formula used by the algorithm: centroid(x,y) = face_detection(x,y)*(ratio) + salnet(x,y)*(1-ratio) . defaults to 0.5 binarize - (optional) - an optional flag that if defined, forces the output to be returned as a base64 encoded string . defaults to false Output { "output":String } output - the resized image data collection URI. Examples Example 1 Input { "height":1500, "width":400, "ratio":0.65, "output":"data://.algo/temp/thumb.jpg", "image":"" } Output { "output":"data://.algo/temp/thumb.jpg" } Example 2 Input { "image":"", "width":400, "height":1500 } Output { "output":"data://.algo/temp/77d3e783-b7fb-4390-b789-af321b69dc89.png" } Credits This algorithm utilizes opencv for image manipulation and editing, dlib's face detection , and deeplearning's Salnet . All images retrieved from on April 25th, 2017

(no tags)

Cost Breakdown

10 cr
royalty per call
1 cr
usage per second
avg duration
This algorithm has permission to call other algorithms which may incur separate royalty and usage costs.

Cost Calculator

API call duration (sec)
API calls
Estimated cost
per calls
for large volume discounts
For additional details on how pricing works, see Algorithmia pricing.

Internet access

This algorithm has Internet access. This is necessary for algorithms that rely on external services, however it also implies that this algorithm is able to send your input data outside of the Algorithmia platform.

Calls other algorithms

This algorithm has permission to call other algorithms. This allows an algorithm to compose sophisticated functionality using other algorithms as building blocks, however it also carries the potential of incurring additional royalty and usage costs from any algorithm that it calls.

To understand more about how algorithm permissions work, see the permissions documentation.

1. Type your input

2. See the result

Running algorithm...

3. Use this algorithm

curl -X POST -d '{{input | formatInput:"curl"}}' -H 'Content-Type: application/json' -H 'Authorization: Simple YOUR_API_KEY'
View cURL Docs
algo auth
algo run algo://media/ContentAwareResize/0.1.3 -d '{{input | formatInput:"cli"}}'
View CLI Docs
import (
  algorithmia ""

input := {{input | formatInput:"go"}}

var client = algorithmia.NewClient("YOUR_API_KEY", "")
algo, _ := client.Algo("algo://media/ContentAwareResize/0.1.3")
resp, _ := algo.Pipe(input)
response := resp.(*algorithmia.AlgoResponse)
View Go Docs
import com.algorithmia.*;
import com.algorithmia.algo.*;

String input = "{{input | formatInput:"java"}}";
AlgorithmiaClient client = Algorithmia.client("YOUR_API_KEY");
Algorithm algo = client.algo("algo://media/ContentAwareResize/0.1.3");
AlgoResponse result = algo.pipeJson(input);
View Java Docs
import com.algorithmia._
import com.algorithmia.algo._

val input = {{input | formatInput:"scala"}}
val client = Algorithmia.client("YOUR_API_KEY")
val algo = client.algo("algo://media/ContentAwareResize/0.1.3")
val result = algo.pipeJson(input)
View Scala Docs
var input = {{input | formatInput:"javascript"}};
           .then(function(output) {
View Javascript Docs
using Algorithmia;

var input = "{{input | formatInput:"cs"}}";
var client = new Client("YOUR_API_KEY");
var algorithm = client.algo("algo://media/ContentAwareResize/0.1.3");
var response = algorithm.pipe<object>(input);
View .NET/C# Docs
var input = {{input | formatInput:"javascript"}};
           .then(function(response) {
View NodeJS Docs
import Algorithmia

input = {{input | formatInput:"python"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('media/ContentAwareResize/0.1.3')
print algo.pipe(input)
View Python Docs

input <- {{input | formatInput:"r"}}
client <- getAlgorithmiaClient("YOUR_API_KEY")
algo <- client$algo("media/ContentAwareResize/0.1.3")
result <- algo$pipe(input)$result
View R Docs
require 'algorithmia'

input = {{input | formatInput:"ruby"}}
client = Algorithmia.client('YOUR_API_KEY')
algo = client.algo('media/ContentAwareResize/0.1.3')
puts algo.pipe(input).result
View Ruby Docs
use algorithmia::Algorithmia;

let input = {{input | formatInput:"rust"}};
let client = Algorithmia::client("YOUR_API_KEY");
let algo = client.algo("media/ContentAwareResize/0.1.3");
let response = algo.pipe(input);
View Rust Docs
import Algorithmia

let input = "{{input | formatInput:"swift"}}";
let client = Algorithmia.client(simpleKey: "YOUR_API_KEY")
let algo = client.algo(algoUri: "media/ContentAwareResize/0.1.3") { resp, error in
View Swift Docs
  • {{comment.username}}