Extract text from an image
Extract Text transformation extracts the text present in the image. User can specify only to just detect text (or) extract text.
This transformation supports png
, jpeg
, jpg
, webp
, cr2
, nef
, rw2
, dng
, orf
, raw
, heic
, heif
, avif
, tiff
and tif
type of files.
You can use the extract text option to:
- Detect text only: It only returns the texts' top-left coordinates and dimensions.
- Detect and get the text (default): It will also return the detected text in addition to coordinates and dimensions.
Instead of getting the output in a traditional CDN URL, you will get a JSON output from the Context API while the CDN URL will return the original image without any modifications.
Params
Detect text (detect_only
)
Detect Text
detects all the texts in an image and returns their postions.
The default value is false
.
- Original Image
- Extract Text (default)
- Context API Response
- Extract Text (detect_only=true)
- Context API Response
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/ocr_text_detect.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg
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/ocr_text_detect.jpeg",
"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/ocr_text_detect.jpeg
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/ocr_text_detect.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg
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/ocr_text_detect.jpeg",
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/ocr_text_detect.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/ocr_text_detect.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/ocr_text_detect.jpeg
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr"}],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr"}],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"extract","plugin":"ocr"}],
"filePath": "images/transformation/ocr_text_detect.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
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": "ocr", "name": "extract"},
},
"filePath": "images/transformation/ocr_text_detect.jpeg",
"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/ocr.extract()/images/transformation/ocr_text_detect.jpeg
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 = "ocr", name = "extract", )
),
filePath = "images/transformation/ocr_text_detect.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
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/ocr_text_detect.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ocr", name: "extract", )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ocr", "name" => "extract", ],
],
"filePath" => "images/transformation/ocr_text_detect.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/ocr_text_detect.jpeg
?>
{
"output": {
"data": [
"bbox": {
"top": 41,
"left": 57,
"height": 84,
"width": 188
},
"text": "OPEN'",
"confidence": 0.861
],
"text": "OPEN'"
}
},
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
filePath: "images/transformation/ocr_text_detect.jpeg",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
"filePath": "images/transformation/ocr_text_detect.jpeg",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
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": "ocr", "name": "extract", "values": []map[string]interface{}{ {"key": "detect_only", "value": "true"},}},
},
"filePath": "images/transformation/ocr_text_detect.jpeg",
"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/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
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 = "ocr", name = "extract", values = hashMapOf( "detect_only" to "true"), )
),
filePath = "images/transformation/ocr_text_detect.jpeg",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
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/ocr_text_detect.jpeg",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ocr", name: "extract", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "detect_only" }, { "value", "true" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ocr", "name" => "extract", "values" => [ [ "key" => "detect_only", "value" => "true" ], ], ],
],
"filePath" => "images/transformation/ocr_text_detect.jpeg",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/ocr_text_detect.jpeg
?>
{
"output": {
"bboxes": [
{
"top": 41,
"left": 57,
"width": 188,
"height": 84
}
]
}
}
The JSON keys are explained in the below table: different properties will be present based on the parameter value
Property | Description |
---|---|
data | It is an array that consists of multiple text's bbox , text and confidence values. |
data[].bbox | It indicates the text's coordinates (top, left) and dimensions (height, width) in pixels. |
data[].text | It is the actual text at the given coordinates (bbox ). |
data[].confidence | It indicates the confidence level of the text in the image (out of 1). |
text | It shows all the texts in an image. |
bboxes | It is a list that shows all the detected text's coordinatess (top, left) and dimensions (height, width) in pixels. |
The Context API Response (default) tab consists of a JSON response that has the coordinates and dimensions in the bbox
property, which is at a distance of 41 px from the top, 57 px from the left, 188 px in width, and 84 px in height. The text
mentioned in the image is "OPEN" and the confidence
level of the text detection is 0.825 out of 1.
The Context API Response (detect_only=true) tab contains a JSON response that is obtained when the detect_only
parameter is selected. It will only return the coordinates and dimensions.
Example with multiple texts in a single image
- Original Image
- Extract Text (default)
- Context API Response
- Extract Text (detect_only=true)
- Context API Response
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [],
"filePath": "images/transformation/multiple-extract-text.png",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png
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/multiple-extract-text.png",
"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/multiple-extract-text.png
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/multiple-extract-text.png",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png
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/multiple-extract-text.png",
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/multiple-extract-text.png
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
],
"filePath" => "images/transformation/multiple-extract-text.png",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/original/images/transformation/multiple-extract-text.png
?>
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr"}],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr"}],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"extract","plugin":"ocr"}],
"filePath": "images/transformation/multiple-extract-text.png",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
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": "ocr", "name": "extract"},
},
"filePath": "images/transformation/multiple-extract-text.png",
"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/ocr.extract()/images/transformation/multiple-extract-text.png
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 = "ocr", name = "extract", )
),
filePath = "images/transformation/multiple-extract-text.png",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
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/multiple-extract-text.png",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ocr", name: "extract", )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ocr", "name" => "extract", ],
],
"filePath" => "images/transformation/multiple-extract-text.png",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract()/images/transformation/multiple-extract-text.png
?>
{
"output": {
"data": [
{
"bbox": {
"top": 221,
"left": 463,
"width": 364,
"height": 134
},
"text": "KEEP",
"confidence": 1
},
{
"bbox": {
"top": 377,
"left": 425,
"width": 433,
"height": 144
},
"text": "CALM",
"confidence": 1
},
{
"bbox": {
"top": 537,
"left": 563,
"width": 158,
"height": 66
},
"text": "AND",
"confidence": 1
},
{
"bbox": {
"top": 621,
"left": 449,
"width": 392,
"height": 134
},
"text": "LOVE",
"confidence": 1
},
{
"bbox": {
"top": 783,
"left": 189,
"width": 490,
"height": 138
},
"text": "BLACK",
"confidence": 1
},
{
"bbox": {
"top": 787,
"left": 715,
"width": 386,
"height": 134
},
"text": "CATS",
"confidence": 1
}
],
"text": "KEEP CALM AND LOVE BLACK CATS"
}
}
- URL
- React
- JavaScript
- Node.js
- Python
- Golang
- Kotlin
- C#
- PHP
<PixelBinImage
url="https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png"
/>
import Pixelbin from "@pixelbin/core";
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.default.utils.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
const Pixelbin = require("@pixelbin/admin");
const obj = {
cloudName: "dummy-cloudname",
zone: "FIDrmb",
version: "v2",
transformations: [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
filePath: "images/transformation/multiple-extract-text.png",
baseUrl: "https://cdn.pixelbin.io",
};
const url = Pixelbin.url.objToUrl(obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
from pixelbin.utils.url import obj_to_url
obj = {
"cloudName": "dummy-cloudname",
"zone": "FIDrmb",
"version": "v2",
"transformations": [{"name":"extract","plugin":"ocr","values":[{"key":"detect_only","value":"true"}]}],
"filePath": "images/transformation/multiple-extract-text.png",
"baseUrl": "https://cdn.pixelbin.io",
}
url = obj_to_url(obj)
# url
# https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
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": "ocr", "name": "extract", "values": []map[string]interface{}{ {"key": "detect_only", "value": "true"},}},
},
"filePath": "images/transformation/multiple-extract-text.png",
"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/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
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 = "ocr", name = "extract", values = hashMapOf( "detect_only" to "true"), )
),
filePath = "images/transformation/multiple-extract-text.png",
baseUrl = "https://cdn.pixelbin.io"
)
val url = Utils.objToUrl(obj)
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
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/multiple-extract-text.png",
zone: "FIDrmb",
baseUrl: "https://cdn.pixelbin.io",
transformations: new List<UrlTransformation>() {
new UrlTransformation(plugin: "ocr", name: "extract", values: new List<Dictionary<string, string>>() { new Dictionary<string, string>() { { "key", "detect_only" }, { "value", "true" } }} )
}
);
string url = Url.ObjToUrl(obj);
}
}
}
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
<?php
require 'vendor/autoload.php';
use Pixelbin\Utils\Url;
$obj = [
"cloudName" => "dummy-cloudname",
"zone" => "FIDrmb",
"version" => "v2",
"options" => [],
"transformations" => [
["plugin" => "ocr", "name" => "extract", "values" => [ [ "key" => "detect_only", "value" => "true" ], ], ],
],
"filePath" => "images/transformation/multiple-extract-text.png",
"baseUrl" => "https://cdn.pixelbin.io",
];
$url = Url::obj_to_url($obj);
// url
// https://cdn.pixelbin.io/v2/dummy-cloudname/FIDrmb/ocr.extract(detect_only:true)/images/transformation/multiple-extract-text.png
?>
{
"output": {
"bboxes": [
{
"top": 221,
"left": 463,
"width": 364,
"height": 134
},
{
"top": 377,
"left": 425,
"width": 433,
"height": 144
},
{
"top": 537,
"left": 563,
"width": 158,
"height": 66
},
{
"top": 621,
"left": 449,
"width": 392,
"height": 134
},
{
"top": 783,
"left": 189,
"width": 490,
"height": 138
},
{
"top": 787,
"left": 715,
"width": 386,
"height": 134
}
]
}
}
The Context API Response tab consists of a JSON response that has multiple texts in the bbox
, and the detected texts are illustrated in the below image in yellow boxes. The overall and individual text(s) detected in the image are highlighted in the JSON response.