Intelligent Crop
Intelligent Crop allows the user to crop an image around the specified object. For example, cropping the image around a bird, car, person.
This transformation supports png
, jpeg
, jpg
, webp
, heif
, and heic
type of files.
Params
Required width (w
)
The required width of the output image (this value should not be greater than the actual image width).
Required height (h
)
The required height of the output image (this value should not be greater than the actual image height).
Padding percentage (p
)
It adds extra space around the cropped image.
For example, suppose the padding of 40% is applied to face cropping. If the earlier crop dimension was 100x100
, then the new dimension will be 140x140
, covering more regions in the crop.
Padding can’t increase dimensions beyond the original image size.
Maintain original aspect (ma
)
If even after cropping the image, you need to maintain the same aspect ratio, this checkbox will save you from calculating the exact dimensions and do it for you. If you want a specific dimension, just pass either the width or the height parameter, or don’t pass to get the original aspect only.
If both height
and width
parameters are passed, or if the aspect ratio
parameter is passed, then the maintain original aspect
parameter will be ignored.
Aspect ratio (ar
)
Allows the user to specify the aspect ratio of the output image.
You can enter a custom aspect ratio in flexible formats (For example, [w_h] or [divided value of w/h] 16_9 or 2 or 0.25).
If both the height
and width
parameters are passed, then the aspect ratio
parameter will be ignored. For example, if the height is 100
and the width is 100
, then the aspect ratio
becomes 1:1
, which will override everything passed by the user.
Gravity towards (g
)
Allows the user to choose the main focus of the output image.
It allows the user to select between the following options: object
, foreground
, face
, or none
. The default value is none
.
If multiple items are found for the selected option, the resultant image will contain all the items. If none are found, then the original image will be returned.
Preferred direction (d
)
Allows the user to select multiple preferred output image directions.
Valid values are north_west
, north
, north_east
, west
, center
, east
, south_west
, south
, and south_east
. The default value is the center
.
For example, in the detected object crop of a model, you want the 100x100 crop of the shoe part; changing the direction from the center to south will give a crop from the bottom; for hair, choose north, and so on.
Object type (obj
)
Allows the user to choose which object to focus on.
This option is only available if the object
option in the Gravity towards
parameter is selected.
From including but not limited to cars, skateboards, and sheep, with over 80+ objects to choose from, gives you the crop containing your required object. If you have multiple objects in the same image, it will intelligently cover all the objects in your crop.
Open to see all available object type
airplane, apple, backpack, banana, baseball_bat, baseball_glove, bear, bed, bench, bicycle, bird, boat, book, bottle, bowl, broccoli, bus, cake, car, carrot, cat, cell_phone, chair, clock, couch, cow, cup, dining_table, dog, donut, elephant, fire_hydrant, fork, frisbee, giraffe, hair_drier, handbag, horse, hot_dog, keyboard, kite, knife, laptop, microwave, motorcycle, mouse, orange, oven, parking_meter, person, pizza, potted_plant, refrigerator, remote, sandwich, scissors, sheep, sink, skateboard, skis, snowboard, spoon, sports_ball, stop_sign, suitcase, surfboard, teddy_bear, tennis_racket, tie, toaster, toilet, toothbrush, traffic_light, train, truck, tv, umbrella, vase, wine_glass, zebra
- Original Image
- Persons
- Baseball Bat
- Baseball Glove
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
},
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
),
filePath = "images/transformation/baseball-game.jpg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/baseball-game.jpg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/baseball-game.jpg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/baseball-game.jpg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"person"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"person"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"person"}]}],
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "ic", "name": "crop", "values": []map[string]interface{}{ {"key": "g", "value": "object"},{"key": "obj", "value": "person"},}},
},
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "ic", name = "crop", values = hashMapOf( "g" to "object","obj" to "person"), )
),
filePath = "images/transformation/baseball-game.jpg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/baseball-game.jpg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ic", name: "crop", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "g" }, { "value", "object" } }, new Dictionary<string, string>() { { "key", "obj" }, { "value", "person" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ic", "name" => "crop", "values" => [ [ "key" => "g", "value" => "object" ], [ "key" => "obj", "value" => "person" ], ], ],
],
"filePath" => "images/transformation/baseball-game.jpg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:person)/images/transformation/baseball-game.jpg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_bat"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_bat"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_bat"}]}],
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "ic", "name": "crop", "values": []map[string]interface{}{ {"key": "g", "value": "object"},{"key": "obj", "value": "baseball_bat"},}},
},
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "ic", name = "crop", values = hashMapOf( "g" to "object","obj" to "baseball_bat"), )
),
filePath = "images/transformation/baseball-game.jpg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/baseball-game.jpg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ic", name: "crop", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "g" }, { "value", "object" } }, new Dictionary<string, string>() { { "key", "obj" }, { "value", "baseball_bat" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ic", "name" => "crop", "values" => [ [ "key" => "g", "value" => "object" ], [ "key" => "obj", "value" => "baseball_bat" ], ], ],
],
"filePath" => "images/transformation/baseball-game.jpg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_bat)/images/transformation/baseball-game.jpg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_glove"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_glove"}]}],
filePath: "images/transformation/baseball-game.jpg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"crop","plugin":"ic","values":[{"key":"g","value":"object"},{"key":"obj","value":"baseball_glove"}]}],
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
package main
import (
"fmt"
"github.com/pixelbin-dev/pixelbin-go/v2/sdk/utils/url"
)
func main() {
obj := map[string]interface{}{
"cloudName": "dummy-cloudname",
"zoneSlug": "FIDrmb",
"version": "v2",
"transformations": []map[string]interface{}{
{"plugin": "ic", "name": "crop", "values": []map[string]interface{}{ {"key": "g", "value": "object"},{"key": "obj", "value": "baseball_glove"},}},
},
"filePath": "images/transformation/baseball-game.jpg",
"baseUrl": "https://cdn.pixelbin.io",
"options": map[string]interface{}{},
}
urlstring, err := url.ObjToUrl(obj)
if err != nil {
fmt.Println(err)
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
import com.pixelbin.url.UrlObj
import com.pixelbin.Utils
import com.pixelbin.transformation.TransformationObj
fun main(){
val obj = UrlObj(
cloudName = "dummy-cloudname",
zone = "FIDrmb",
version = "v2",
transformation = arrayListOf(
TransformationObj( plugin = "ic", name = "crop", values = hashMapOf( "g" to "object","obj" to "baseball_glove"), )
),
filePath = "images/transformation/baseball-game.jpg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
using System;
using System.Collections.Generic;
using System.IO;
using Pixelbin.Utils;
namespace ExampleNamespace
{
class ExampleClass
{
static void Main(string[] args)
{
UrlObj obj = new UrlObj(
version: "v2",
cloudName: "dummy-cloudname",
filePath: "images/transformation/baseball-game.jpg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ic", name: "crop", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "g" }, { "value", "object" } }, new Dictionary<string, string>() { { "key", "obj" }, { "value", "baseball_glove" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ic", "name" => "crop", "values" => [ [ "key" => "g", "value" => "object" ], [ "key" => "obj", "value" => "baseball_glove" ], ], ],
],
"filePath" => "images/transformation/baseball-game.jpg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ic.crop(g:object,obj:baseball_glove)/images/transformation/baseball-game.jpg
?>
Context API Response
Along with providing a transformed image, the Crop Image
transformation also provides contextual information about the transformation. Go to Context to learn more.
The context response of cropping an image is a JSON, as shown below:
[
{
"name": "crop",
"operation": "IntelligentCrop",
"identifier": "ic",
"data": {
"attributes": {
"top": 47,
"left": 24,
"height": 284,
"width": 462,
"success": true,
"gravity": "object",
"direction": "center",
"target_width": null,
"target_height": null
}
},
"metadata": {...}
},
{
"name": "extract",
"operation": "Basic",
"identifier": "t",
"data": {},
"metadata": {...}
}
]
The Crop Image
transformation actually just gives the bounding rectangle that encompasses the portion of the image that needs to cropped (highlighted in yellow color). The actual cropping of the image is done by the Extract transformation (highlighted in green color).
Further, the JSON keys for the attributes
property are also described in the table below:
Property | Description |
---|---|
top | The distance in pixels between the top edge of the original image and the top edge of the cropped image. |
left | The distance in pixels between the left edge of the original image and the left edge of the cropped image. |
height | The height in pixels of the cropped image. |
width | The width in pixels of the cropped image. |
success | The boolean value indicates whether the image has been cropped. If the value is true , the image has been effectively cropped; otherwise, it gives false . |
gravity | The value entered in the Gravity towards parameter. |
direction | The value entered in the Preferred direction parameter. |
target_width | If Required width is set, it will show the specified value; otherwise, it will be null . |
target_height | If Required height is set, it will show the specified value; otherwise, it will be null . |
Example showing crop area selection
Below is the corresponding Context API Response.
[
{
"name": "crop",
"operation": "IntelligentCrop",
"identifier": "ic",
"data": {
"attributes": {
"top": 204,
"left": 740,
"height": 617,
"width": 602,
"success": true,
"gravity": "object",
"direction": "center",
"target_width": null,
"target_height": null
}
},
"metadata": {...}
},
{
"name": "extract",
"operation": "Basic",
"identifier": "t",
"data": {},
"metadata": {...}
}
]
The highlighted properties are used by the Extract
transformation to crop the image.
As shown, the object to crop is at a distance of 204px
from the top
and 740px
from the left
; the object's height
is 617px
and its width
is 602px
.