> ## Documentation Index
> Fetch the complete documentation index at: https://cloudinary.com/documentation/llms.txt
> Use this file to discover all available pages before exploring further.

# Imagga Auto Tagging


[Cloudinary](https://cloudinary.com) is a cloud-based service that provides an end-to-end asset management solution including uploads, storage, transformations, optimizations and delivery. Cloudinary offers a very rich set of image transformation and analysis capabilities and allows you to extract the semantic data from uploaded images: photo metadata (Exif & IPTC) including location and camera details, coordinates of automatically detected faces, color histogram and predominant colors. In addition, Cloudinary allows you to assign multiple tags to images for listing and managing your media assets.

[Imagga](https://imagga.com/) develops and offers technologies, services, and online tools for visual image recognition. Cloudinary provides an add-on for Imagga's automatic image tagging capabilities, fully integrated into Cloudinary's image management and transformation pipeline. Imagga analyses image data and automatically identifies scenes and suggests tags, a process that would take huge amounts of time and resources if performed manually. Imagga's technology includes state-of-the-art machine learning approaches that allow it to be trained in the recognition of various visual objects and concepts. Combined with big manually created data sets containing the visual characteristics of images and their associated tags, results in outstanding performance in terms of the time needed to process large photo volumes with a very high precision rate.

With the Imagga auto-tagging add-on, you can extend Cloudinary's powerful semantic data extraction and image tagging features. When using the Imagga auto-tagging add-on, your images are automatically tagged according to the categories detected in each image.
#### Getting started

Before you can use the Imagga Auto Tagging add-on:

* You must have a Cloudinary account. If you don't already have one, you can [sign up](https://cloudinary.com/users/register_free) for a free account. 

* Register for the add-on: make sure you're logged in to your account and then go to the [Add-ons](https://console.cloudinary.com/app/settings/addons) page. For more information about add-on registrations, see [Registering for add-ons](cloudinary_add_ons#registering_for_add_ons).

* Keep in mind that many of the examples on this page use our SDKs. For SDK installation and configuration details, see the relevant [SDK](cloudinary_sdks) guide.
  
* If you're new to Cloudinary, you may want to take a look at the [Developer Kickstart](dev_kickstart) for a hands-on, step-by-step introduction to a variety of features.

## Image recognition and categorization

Take a look at the following photo, depicting some turtles:
![turtles.jpg](https://res.cloudinary.com/demo/image/upload/turtles.jpg "thumb: w_400")

```nodejs
cloudinary.image("turtles.jpg")
```

```react
new CloudinaryImage("turtles.jpg");
```

```vue
new CloudinaryImage("turtles.jpg");
```

```angular
new CloudinaryImage("turtles.jpg");
```

```js
new CloudinaryImage("turtles.jpg");
```

```python
CloudinaryImage("turtles.jpg").image()
```

```php
(new ImageTag('turtles.jpg'));
```

```java
cloudinary.url().transformation(new Transformation().imageTag("turtles.jpg");
```

```ruby
cl_image_tag("turtles.jpg")
```

```csharp
cloudinary.Api.UrlImgUp.BuildImageTag("turtles.jpg")
```

```dart
cloudinary.image('turtles.jpg').transformation(Transformation());
```

```swift
imageView.cldSetImage(cloudinary.createUrl().generate("turtles.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().generate("turtles.jpg");
```

```flutter
cloudinary.image('turtles.jpg').transformation(Transformation());
```

```kotlin
cloudinary.image {
	publicId("turtles.jpg") 
}.generate()
```

```jquery
$.cloudinary.image("turtles.jpg")
```

```react_native
new CloudinaryImage("turtles.jpg");
```

By setting the `categorization` parameter to `imagga_tagging` when calling Cloudinary's [upload](image_upload_api_reference#upload) or [update](admin_api#update_details_of_an_existing_resource) methods, Imagga is used to automatically classify the scenes of the uploaded or specified existing image. For example:

```multi
|ruby
Cloudinary::Uploader.upload("turtles.jpg", 
  categorization: "imagga_tagging")

|php_2
$cloudinary->uploadApi()->upload("turtles.jpg", 
  ["categorization" => "imagga_tagging"]);

|python
cloudinary.uploader.upload("turtles.jpg",
  categorization = "imagga_tagging")

|nodejs
cloudinary.v2.uploader
.upload("turtles.jpg", 
  { categorization: "imagga_tagging" })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("turtles.jpg", ObjectUtils.asMap(
  "categorization", "imagga_tagging"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"turtles.jpg"),
  Categorization = "imagga_tagging"
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "turtles.jpg", uploader.UploadParams{
		Categorization: "imagga_tagging"})

|android
MediaManager.get().upload("turtles.jpg")
  .option("categorization", "imagga_tagging").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("imagga_tagging")
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "turtles.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/turtles.jpg' -F 'categorization=imagga_tagging' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "turtles.jpg" categorization="imagga_tagging"
```

The upload API response includes the automatic categorization identified by the Imagga auto-tagging add-on. As can be seen in the response snippet below, various categories were automatically detected in the uploaded photo. The confidence score is a numerical value that represents the confidence level of the detected category, where 1.0 means 100% confidence.

```json
{
...
"info": {
    "categorization": {
      "imagga_tagging": {
        "status": "complete",
        "data": [
          {  "tag": "sea turtle",  "confidence": 1.0 },
          {  "tag": "loggerhead",  "confidence": 1.0 },
          {  "tag": "turtle",  "confidence": 0.8903 },
          {  "tag": "crab",  "confidence": 0.3089  },
          {  "tag": "king crab", "confidence": 0.2722 },
          {  "tag": "crustacean", "confidence": 0.1587 },
          {  "tag": "dungeness crab", "confidence": 0.1102 },
          {  "tag": "sea", "confidence": 0.1049 },
          {  "tag": "water", "confidence": 0.0986 },
          {  "tag": "ocean", "confidence": 0.0849 },
          {  "tag": "arthropod", "confidence": 0.0764 },
          {  "tag": "fish", "confidence": 0.0755 }]}}}
```

> **TIP**:
>
> :title=Tips

> * You can use **upload presets** to centrally define a set of upload options including add-on operations to apply, instead of specifying them in each upload call. You can define multiple upload presets, and apply different presets in different upload scenarios. You can create new upload presets in the **Upload Presets** page of the [Console Settings](https://console.cloudinary.com/app/settings/upload/presets) or using the [upload_presets](admin_api#upload_presets) Admin API method. From the **Upload** page of the Console Settings, you can also select default upload presets to use for image, video, and raw API uploads (respectively) as well as default presets for image, video, and raw uploads performed via the Media Library UI. 
> **Learn more**: [Upload presets](upload_presets)* You can run multiple categorization add-ons on the resource. The `categorization` parameter accepts a comma-separated list of all the Cloudinary categorization add-ons to run on the resource.

## Adding resource tags to images

Automatically categorizing your images is a useful way to organize your Cloudinary media assets, and by also providing the `auto_tagging` parameter to an `upload` or `update` call, images are automatically assigned resource tags based on the detected scene categories. The value of the `auto_tagging` parameter is the minimum confidence score of a detected category that should be automatically used as an assigned resource tag. Assigning these resource tags allows you to list and search images using Cloudinary's API and Web interface.

The following code example automatically uploads and tags an image with all detected categories that have a score higher than 0.4.

```multi
|ruby
Cloudinary::Uploader.upload("turtles.jpg", 
  categorization: "imagga_tagging", 
  auto_tagging: 0.4)

|php_2
$cloudinary->uploadApi()->upload("turtles.jpg", [
    "categorization" => "imagga_tagging", 
    "auto_tagging" => 0.4]);

|python
cloudinary.uploader.upload("turtles.jpg",
  categorization = "imagga_tagging", 
  auto_tagging = 0.4)

|nodejs
cloudinary.v2.uploader
.upload("turtles.jpg", 
  { categorization: "imagga_tagging", 
    auto_tagging: 0.4 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("turtles.jpg", 
  ObjectUtils.asMap(
    "categorization", "imagga_tagging", 
    "auto_tagging", "0.4"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"turtles.jpg"),
  Categorization = "imagga_tagging",
  AutoTagging = 0.4
};
var uploadResult = cloudinary.Upload(uploadParams); 

|go
resp, err := cld.Upload.Upload(ctx, "turtles.jpg", uploader.UploadParams{
		Categorization: "imagga_tagging",
		AutoTagging:    0.4})

|android
MediaManager.get().upload("turtles.jpg")
  .option("categorization", "imagga_tagging")
  .option("auto_tagging", "0.4").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("imagga_tagging")
  .setAutoTagging(0.4)
var mySig = MyFunction(params)  // your own function that returns a signature generated on your backend
params.setSignature(CLDSignature(signature: mySig.signature, timestamp: mySig.timestamp))
let request = cloudinary.createUploader().signedUpload(
  url: "turtles.jpg", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/turtles.jpg' -F 'categorization=imagga_tagging' -F 'auto_tagging=0.4' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "turtles.jpg" categorization="imagga_tagging" auto_tagging=0.4
```

The response of the upload API call above returns the detected categories as well as the assigned tags. In this case, only the 'sea turtle', 'loggerhead' and 'turtle' categories have a high enough score to be used as tags.

```json
{ 
  ...    
  "tags": [ "sea turtle", "loggerhead", "turtle" ]   
  ...  

```

You can also use the `update` method to apply Imagga auto-tagging to already uploaded images, based on their public IDs, and then automatically tag them according to the detected categories.

For example, the following image was uploaded to Cloudinary with the 'sample' public ID.
![sample.jpg](https://res.cloudinary.com/demo/image/upload/sample.jpg "thumb: w_400")

```nodejs
cloudinary.image("sample.jpg")
```

```react
new CloudinaryImage("sample.jpg");
```

```vue
new CloudinaryImage("sample.jpg");
```

```angular
new CloudinaryImage("sample.jpg");
```

```js
new CloudinaryImage("sample.jpg");
```

```python
CloudinaryImage("sample.jpg").image()
```

```php
(new ImageTag('sample.jpg'));
```

```java
cloudinary.url().transformation(new Transformation().imageTag("sample.jpg");
```

```ruby
cl_image_tag("sample.jpg")
```

```csharp
cloudinary.Api.UrlImgUp.BuildImageTag("sample.jpg")
```

```dart
cloudinary.image('sample.jpg').transformation(Transformation());
```

```swift
imageView.cldSetImage(cloudinary.createUrl().generate("sample.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().generate("sample.jpg");
```

```flutter
cloudinary.image('sample.jpg').transformation(Transformation());
```

```kotlin
cloudinary.image {
	publicId("sample.jpg") 
}.generate()
```

```jquery
$.cloudinary.image("sample.jpg")
```

```react_native
new CloudinaryImage("sample.jpg");
```

The following code sample uses Cloudinary's `update` method to apply Imagga's automatic image tagging and categorization to the `sample` uploaded image, and then automatically assign resource tags based on the categories detected with over a 50% confidence level.

```multi
|ruby
Cloudinary::Api.update("sample", 
  categorization: "imagga_tagging", 
  auto_tagging: 0.5)

|python
cloudinary.api.update("sample",
  categorization = "imagga_tagging", 
  auto_tagging = 0.5)

|nodejs
cloudinary.v2.api
.update("sample", 
  { categorization: "imagga_tagging", 
    auto_tagging: 0.5 })
.then(result=>console.log(result));

|java
cloudinary.api().update("sample", 
  ObjectUtils.asMap(
    "categorization", "imagga_tagging", 
    "auto_tagging", 0.5));

|csharp
var updateParams = new UpdateParams("sample") 
{
  Categorization = "imagga_tagging",
  AutoTagging = 0.5
};
var updateResult = cloudinary.Update(updateParams); 

|go
resp, err := cld.Admin.UpdateAsset(ctx, admin.UpdateAssetParams{
		PublicID:       "sample",
		Categorization: "imagga_tagging",
		AutoTagging:    0.5})

|cli
cld admin update "sample" categorization="imagga_tagging" auto_tagging=0.5
```

The response of the `update` API call includes the detected categories, and automatically assigned tags. As you can see in the response snippet below, the 'pink' and 'flower' scene categories were detected with a confidence score of over 50%, which led to them being auto-assigned as tags.

```json
{
  ...
  "tags": [ "pink", "flower" ]
  "info": {
    "categorization": {
      "imagga_tagging": {
        "status": "complete",
        "data": [
          { "tag": "pink", "confidence": 0.822 },
          { "tag": "flower", "confidence": 0.6306 },
          { "tag": "flowers", "confidence": 0.3778 },
          { "tag": "plant", "confidence": 0.3667
         ...

}
```

You can use the Admin API's `resource` method to return the details of a resource, including the scene categories that you already extracted using the `upload` or `update` methods.

```multi
|ruby
Cloudinary::Api.resource("sample")

|php_2
$api->asset("sample");

|python
cloudinary.api.resource("sample")

|nodejs
cloudinary.v2.api
.resource("sample")
.then(result=>console.log(result));

|java
cloudinary.api().resource("sample", ObjectUtils.emptyMap());

|csharp
var getResourceResult = cloudinary.GetResource(new GetResourceParams("sample"));

|go
resp, err := cld.Admin.Asset(ctx, admin.AssetParams{PublicID: "sample"})

|cli
cld admin resource "sample"
```

## Multi-language support

The automatic image categorization and tagging features also support multiple languages. You can get results in other languages by adding the 2-letter Language Code to the `categorization` parameter value of `imagga_tagging`, separating each additional language with a colon. For example, to get results in Finnish (fi) and Danish (da), set the value to `imagga_tagging:fi:da`. The full list of supported languages and their language codes can be found [here](https://docs.imagga.com/#multi-language-support).
