> ## 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.

# AI in action


Cloudinary Image (Programmable Media) offers an array of AI-powered features that enable you to effortlessly transform, manage, and moderate your images and videos. 

Whether you're seeking to enhance visual appeal, streamline content analysis, or ensure seamless moderation, our AI capabilities have got you covered. From generative AI transformations to advanced content analysis, and even AI-driven video playback features, you'll discover how to leverage AI to create, refine, and moderate your media with precision and creativity. 

{notes}

* Some of the features require you to [register for an add-on](cloudinary_add_ons#registering_for_add_ons). Once registered, you can try them out for free.
* There are [special transformation counts](transformation_counts#special_transformation_counts) for some of the features.

{/note}

{table:class=no-borders overview} Contents | Description  
--|--
[Generative AI transformations](#generative_ai_transformations) | Creatively transform your images, using AI to automatically generate pixels that integrate seamlessly into the picture. Use these transformations to extend your images to new dimensions, replace backgrounds, remove, replace or recolor items, or restore degraded images. 
[AI content analysis for transformations](#ai_content_analysis_for_transformations) | Transform your images and videos based on their content. Ensure that you keep the content that matters to you when cropping your media and removing backgrounds. Leverage Cloudinary's understanding of your content to create video previews, apply drop shadows, apply different artistic styles and more. 
[AI content analysis for management](#ai_content_analysis_for_management) | Save yourself hours of time manually analyzing images, by using AI for tagging and moderation. Auto-tag your assets to help you to categorize and organize your assets, and make them easier to find within your product environment. Automatically moderate your assets based on their content to check for inappropriate images and videos.
[AI video playback features](#ai_video_playback_features) | Use AI to enhance your users' video playback experience. Transcribe and translate videos with ease, then add captions and subtitles to them. Discover the most interesting parts of your videos and display a visual representation in the Video Player seek bar.

## Generative AI transformations

### Generative background replace

[Generative background replace](generative_ai_transformations#generative_background_replace) uses AI to generate new backgrounds for images. Customize the background with a prompt or let AI generate it based on the image content. Place your products in different environments to appeal to more potential buyers, or simply enable content creativity programmatically. 

![Headphones with generated background](https://res.cloudinary.com/demo/image/upload/e_gen_background_replace/docs/headphones.jpg "with_image:false")

```nodejs
cloudinary.image("docs/headphones.jpg", {effect: "gen_background_replace"})
```

```react
new CloudinaryImage("docs/headphones.jpg").effect(
  generativeBackgroundReplace()
);
```

```vue
new CloudinaryImage("docs/headphones.jpg").effect(
  generativeBackgroundReplace()
);
```

```angular
new CloudinaryImage("docs/headphones.jpg").effect(
  generativeBackgroundReplace()
);
```

```js
new CloudinaryImage("docs/headphones.jpg").effect(
  generativeBackgroundReplace()
);
```

```python
CloudinaryImage("docs/headphones.jpg").image(effect="gen_background_replace")
```

```php
(new ImageTag('docs/headphones.jpg'))
	->effect(Effect::generativeBackgroundReplace());
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_background_replace")).imageTag("docs/headphones.jpg");
```

```ruby
cl_image_tag("docs/headphones.jpg", effect: "gen_background_replace")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_background_replace")).BuildImageTag("docs/headphones.jpg")
```

```dart
cloudinary.image('docs/headphones.jpg').transformation(Transformation()
	.effect(Effect.generativeBackgroundReplace()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_background_replace")).generate("docs/headphones.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_background_replace")).generate("docs/headphones.jpg");
```

```flutter
cloudinary.image('docs/headphones.jpg').transformation(Transformation()
	.effect(Effect.generativeBackgroundReplace()));
```

```kotlin
cloudinary.image {
	publicId("docs/headphones.jpg")
	 effect(Effect.generativeBackgroundReplace()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/headphones.jpg", {effect: "gen_background_replace"})
```

```react_native
new CloudinaryImage("docs/headphones.jpg").effect(
  generativeBackgroundReplace()
);
```

Try it on your own images

### Generative fill

[Generative fill](generative_ai_transformations#generative_fill), utilized with various cropping methods, uses AI to expand original images, aiding in orientation changes. It seamlessly integrates AI-generated backgrounds with existing content, facilitating creative solutions and reducing workflow time, while allowing programmatic control over transformations, enhancing content creativity and velocity.

![Bridge with rails](https://res.cloudinary.com/demo/image/upload/ar_16:9,b_gen_fill,c_pad,w_1500/docs/bridge-rails.jpg "with_image:false")

```nodejs
cloudinary.image("docs/bridge-rails.jpg", {aspect_ratio: "16:9", background: "gen_fill", width: 1500, crop: "pad"})
```

```react
new CloudinaryImage("docs/bridge-rails.jpg").resize(
  pad()
    .width(1500)
    .aspectRatio(ar16X9())
    .background(generativeFill())
);
```

```vue
new CloudinaryImage("docs/bridge-rails.jpg").resize(
  pad()
    .width(1500)
    .aspectRatio(ar16X9())
    .background(generativeFill())
);
```

```angular
new CloudinaryImage("docs/bridge-rails.jpg").resize(
  pad()
    .width(1500)
    .aspectRatio(ar16X9())
    .background(generativeFill())
);
```

```js
new CloudinaryImage("docs/bridge-rails.jpg").resize(
  pad()
    .width(1500)
    .aspectRatio(ar16X9())
    .background(generativeFill())
);
```

```python
CloudinaryImage("docs/bridge-rails.jpg").image(aspect_ratio="16:9", background="gen_fill", width=1500, crop="pad")
```

```php
(new ImageTag('docs/bridge-rails.jpg'))
	->resize(Resize::pad()->width(1500)
	->aspectRatio(
	AspectRatio::ar16X9())
	->background(
	Background::generativeFill())
	);
```

```java
cloudinary.url().transformation(new Transformation().aspectRatio("16:9").background("gen_fill").width(1500).crop("pad")).imageTag("docs/bridge-rails.jpg");
```

```ruby
cl_image_tag("docs/bridge-rails.jpg", aspect_ratio: "16:9", background: "gen_fill", width: 1500, crop: "pad")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().AspectRatio("16:9").Background("gen_fill").Width(1500).Crop("pad")).BuildImageTag("docs/bridge-rails.jpg")
```

```dart
cloudinary.image('docs/bridge-rails.jpg').transformation(Transformation()
	.resize(Resize.pad().width(1500)
	.aspectRatio(
	AspectRatio.ar16X9())
	.background(
	Background.generativeFill())
	));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setAspectRatio("16:9").setBackground("gen_fill").setWidth(1500).setCrop("pad")).generate("docs/bridge-rails.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().aspectRatio("16:9").background("gen_fill").width(1500).crop("pad")).generate("docs/bridge-rails.jpg");
```

```flutter
cloudinary.image('docs/bridge-rails.jpg').transformation(Transformation()
	.resize(Resize.pad().width(1500)
	.aspectRatio(
	AspectRatio.ar16X9())
	.background(
	Background.generativeFill())
	));
```

```kotlin
cloudinary.image {
	publicId("docs/bridge-rails.jpg")
	 resize(Resize.pad() { width(1500)
	 aspectRatio(
	AspectRatio.ar16X9())
	 background(
	Background.generativeFill())
	 }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/bridge-rails.jpg", {aspect_ratio: "16:9", background: "gen_fill", width: 1500, crop: "pad"})
```

```react_native
new CloudinaryImage("docs/bridge-rails.jpg").resize(
  pad()
    .width(1500)
    .aspectRatio(ar16X9())
    .background(generativeFill())
);
```

Try it on your own images

Watch a video tutorial

#### How are our customers using generative fill? One of our customers provides a template for their clients to create brochures in order to promote their businesses. The template requires an image to be of a certain aspect ratio.  If the image that the client uploads doesn't match the aspect ratio, then rather than crop out important parts of the image, they use generative fill to increase the image in a seamless way to fit the required dimensions. 

Here it is in action:

![Use case](https://res.cloudinary.com/cloudinary/video/upload/t_black_border/c_scale,w_600/training/gen_fill_cust)

Here's the transformation on the image shown in the video:

![House picture resized](https://res.cloudinary.com/demo/image/upload/ar_1.0,b_gen_fill,c_pad,w_1280/docs/lifestyle.jpg "with_image:false")

```nodejs
cloudinary.image("docs/lifestyle.jpg", {aspect_ratio: "1.0", background: "gen_fill", width: 1280, crop: "pad"})
```

```react
new CloudinaryImage("docs/lifestyle.jpg").resize(
  pad()
    .width(1280)
    .aspectRatio("1.0")
    .background(generativeFill())
);
```

```vue
new CloudinaryImage("docs/lifestyle.jpg").resize(
  pad()
    .width(1280)
    .aspectRatio("1.0")
    .background(generativeFill())
);
```

```angular
new CloudinaryImage("docs/lifestyle.jpg").resize(
  pad()
    .width(1280)
    .aspectRatio("1.0")
    .background(generativeFill())
);
```

```js
new CloudinaryImage("docs/lifestyle.jpg").resize(
  pad()
    .width(1280)
    .aspectRatio("1.0")
    .background(generativeFill())
);
```

```python
CloudinaryImage("docs/lifestyle.jpg").image(aspect_ratio="1.0", background="gen_fill", width=1280, crop="pad")
```

```php
(new ImageTag('docs/lifestyle.jpg'))
	->resize(Resize::pad()->width(1280)
->aspectRatio(1.0)
	->background(
	Background::generativeFill())
	);
```

```java
cloudinary.url().transformation(new Transformation().aspectRatio("1.0").background("gen_fill").width(1280).crop("pad")).imageTag("docs/lifestyle.jpg");
```

```ruby
cl_image_tag("docs/lifestyle.jpg", aspect_ratio: "1.0", background: "gen_fill", width: 1280, crop: "pad")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().AspectRatio("1.0").Background("gen_fill").Width(1280).Crop("pad")).BuildImageTag("docs/lifestyle.jpg")
```

```dart
cloudinary.image('docs/lifestyle.jpg').transformation(Transformation()
	.resize(Resize.pad().width(1280)
.aspectRatio('1.0')
	.background(
	Background.generativeFill())
	));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setAspectRatio("1.0").setBackground("gen_fill").setWidth(1280).setCrop("pad")).generate("docs/lifestyle.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().aspectRatio("1.0").background("gen_fill").width(1280).crop("pad")).generate("docs/lifestyle.jpg");
```

```flutter
cloudinary.image('docs/lifestyle.jpg').transformation(Transformation()
	.resize(Resize.pad().width(1280)
.aspectRatio('1.0')
	.background(
	Background.generativeFill())
	));
```

```kotlin
cloudinary.image {
	publicId("docs/lifestyle.jpg")
	 resize(Resize.pad() { width(1280)
 aspectRatio(1.0F)
	 background(
	Background.generativeFill())
	 }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/lifestyle.jpg", {aspect_ratio: "1.0", background: "gen_fill", width: 1280, crop: "pad"})
```

```react_native
new CloudinaryImage("docs/lifestyle.jpg").resize(
  pad()
    .width(1280)
    .aspectRatio("1.0")
    .background(generativeFill())
);
```

Original image

Seamlessly fill the extended height

### Generative recolor

[Generative recolor](generative_ai_transformations#generative_recolor) enables color alterations in images using natural language, through AI and NLP. This feature simplifies creating color variants, especially beneficial for e-commerce products, by allowing color changes at scale via API​.

![White sofa recolored green](https://res.cloudinary.com/demo/image/upload/e_gen_recolor:prompt_sofa;to-color_green/docs/white-sofa.jpg "with_image:false")

```nodejs
cloudinary.image("docs/white-sofa.jpg", {effect: "gen_recolor:prompt_sofa;to-color_green"})
```

```react
new CloudinaryImage("docs/white-sofa.jpg").effect(
  generativeRecolor("sofa", "green")
);
```

```vue
new CloudinaryImage("docs/white-sofa.jpg").effect(
  generativeRecolor("sofa", "green")
);
```

```angular
new CloudinaryImage("docs/white-sofa.jpg").effect(
  generativeRecolor("sofa", "green")
);
```

```js
new CloudinaryImage("docs/white-sofa.jpg").effect(
  generativeRecolor("sofa", "green")
);
```

```python
CloudinaryImage("docs/white-sofa.jpg").image(effect="gen_recolor:prompt_sofa;to-color_green")
```

```php
(new ImageTag('docs/white-sofa.jpg'))
	->effect(Effect::generativeRecolor("sofa",Color::GREEN));
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_recolor:prompt_sofa;to-color_green")).imageTag("docs/white-sofa.jpg");
```

```ruby
cl_image_tag("docs/white-sofa.jpg", effect: "gen_recolor:prompt_sofa;to-color_green")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_recolor:prompt_sofa;to-color_green")).BuildImageTag("docs/white-sofa.jpg")
```

```dart
cloudinary.image('docs/white-sofa.jpg').transformation(Transformation()
	.effect(Effect.generativeRecolor("sofa",Color.GREEN)));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_recolor:prompt_sofa;to-color_green")).generate("docs/white-sofa.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_recolor:prompt_sofa;to-color_green")).generate("docs/white-sofa.jpg");
```

```flutter
cloudinary.image('docs/white-sofa.jpg').transformation(Transformation()
	.effect(Effect.generativeRecolor("sofa",Color.GREEN)));
```

```kotlin
cloudinary.image {
	publicId("docs/white-sofa.jpg")
	 effect(Effect.generativeRecolor("sofa",Color.GREEN)) 
}.generate()
```

```jquery
$.cloudinary.image("docs/white-sofa.jpg", {effect: "gen_recolor:prompt_sofa;to-color_green"})
```

```react_native
new CloudinaryImage("docs/white-sofa.jpg").effect(
  generativeRecolor("sofa", "green")
);
```

Try it on your own images

### Generative remove

[Generative remove](generative_ai_transformations#generative_remove) effortlessly eliminates unwanted objects, text, or user-defined regions from images, providing a valuable capability across various industries. The feature is accessible via Cloudinary's APIs, enabling scalable object removal tasks which traditionally would require significant time and effort.

![Salad with fork removed](https://res.cloudinary.com/demo/image/upload/e_gen_remove:prompt_fork/docs/avocado-salad.jpg "with_image:false")

```nodejs
cloudinary.image("docs/avocado-salad.jpg", {effect: "gen_remove:prompt_fork"})
```

```react
new CloudinaryImage("docs/avocado-salad.jpg").effect(
  generativeRemove().prompt("fork")
);
```

```vue
new CloudinaryImage("docs/avocado-salad.jpg").effect(
  generativeRemove().prompt("fork")
);
```

```angular
new CloudinaryImage("docs/avocado-salad.jpg").effect(
  generativeRemove().prompt("fork")
);
```

```js
new CloudinaryImage("docs/avocado-salad.jpg").effect(
  generativeRemove().prompt("fork")
);
```

```python
CloudinaryImage("docs/avocado-salad.jpg").image(effect="gen_remove:prompt_fork")
```

```php
(new ImageTag('docs/avocado-salad.jpg'))
	->effect(Effect::generativeRemove()->prompt("fork"));
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_remove:prompt_fork")).imageTag("docs/avocado-salad.jpg");
```

```ruby
cl_image_tag("docs/avocado-salad.jpg", effect: "gen_remove:prompt_fork")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_remove:prompt_fork")).BuildImageTag("docs/avocado-salad.jpg")
```

```dart
cloudinary.image('docs/avocado-salad.jpg').transformation(Transformation()
	.effect(Effect.generativeRemove().prompt("fork")));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_remove:prompt_fork")).generate("docs/avocado-salad.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_remove:prompt_fork")).generate("docs/avocado-salad.jpg");
```

```flutter
cloudinary.image('docs/avocado-salad.jpg').transformation(Transformation()
	.effect(Effect.generativeRemove().prompt("fork")));
```

```kotlin
cloudinary.image {
	publicId("docs/avocado-salad.jpg")
	 effect(Effect.generativeRemove() { prompt("fork") }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/avocado-salad.jpg", {effect: "gen_remove:prompt_fork"})
```

```react_native
new CloudinaryImage("docs/avocado-salad.jpg").effect(
  generativeRemove().prompt("fork")
);
```

Try it on your own images

#### How are our customers using generative remove? One of our customers uses images provided by third parties to sell their experiences. When the customer wants to reuse an image for a different purpose, for example an email, they often need to remove some text from the image.  Using generative remove, they can remove the text from the image, ensuring that the result still looks authentic.

Here it is in action:

![Use case](https://res.cloudinary.com/cloudinary/video/upload/t_black_border/c_scale,w_600/training/gen_remove)

Here's the transformation on the image shown in the video:

![Midnight violin with text removed](https://res.cloudinary.com/demo/image/upload/e_gen_remove:prompt_text/docs/midnight-violin.jpg "with_image:false")

```nodejs
cloudinary.image("docs/midnight-violin.jpg", {effect: "gen_remove:prompt_text"})
```

```react
new CloudinaryImage("docs/midnight-violin.jpg").effect(
  generativeRemove().prompt("text")
);
```

```vue
new CloudinaryImage("docs/midnight-violin.jpg").effect(
  generativeRemove().prompt("text")
);
```

```angular
new CloudinaryImage("docs/midnight-violin.jpg").effect(
  generativeRemove().prompt("text")
);
```

```js
new CloudinaryImage("docs/midnight-violin.jpg").effect(
  generativeRemove().prompt("text")
);
```

```python
CloudinaryImage("docs/midnight-violin.jpg").image(effect="gen_remove:prompt_text")
```

```php
(new ImageTag('docs/midnight-violin.jpg'))
	->effect(Effect::generativeRemove()->prompt("text"));
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_remove:prompt_text")).imageTag("docs/midnight-violin.jpg");
```

```ruby
cl_image_tag("docs/midnight-violin.jpg", effect: "gen_remove:prompt_text")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_remove:prompt_text")).BuildImageTag("docs/midnight-violin.jpg")
```

```dart
cloudinary.image('docs/midnight-violin.jpg').transformation(Transformation()
	.effect(Effect.generativeRemove().prompt("text")));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_remove:prompt_text")).generate("docs/midnight-violin.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_remove:prompt_text")).generate("docs/midnight-violin.jpg");
```

```flutter
cloudinary.image('docs/midnight-violin.jpg').transformation(Transformation()
	.effect(Effect.generativeRemove().prompt("text")));
```

```kotlin
cloudinary.image {
	publicId("docs/midnight-violin.jpg")
	 effect(Effect.generativeRemove() { prompt("text") }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/midnight-violin.jpg", {effect: "gen_remove:prompt_text"})
```

```react_native
new CloudinaryImage("docs/midnight-violin.jpg").effect(
  generativeRemove().prompt("text")
);
```

Original image

Seamlessly remove the text

### Generative replace

[Generative replace](generative_ai_transformations#generative_replace) uses AI to replace objects within images with alternative objects or images, while maintaining a natural look. This feature allows for creative or functional alterations in images, enhancing the versatility and usage of your media assets.

![Replaced sunglasses](https://res.cloudinary.com/demo/image/upload/e_gen_replace:from_sunglasses;to_black%20sunglasses/docs/woman-sunglasses.jpg "with_image:false")

```nodejs
cloudinary.image("docs/woman-sunglasses.jpg", {effect: "gen_replace:from_sunglasses;to_black sunglasses"})
```

```react
new CloudinaryImage("docs/woman-sunglasses.jpg").effect(
  generativeReplace().from("sunglasses").to("black sunglasses")
);
```

```vue
new CloudinaryImage("docs/woman-sunglasses.jpg").effect(
  generativeReplace().from("sunglasses").to("black sunglasses")
);
```

```angular
new CloudinaryImage("docs/woman-sunglasses.jpg").effect(
  generativeReplace().from("sunglasses").to("black sunglasses")
);
```

```js
new CloudinaryImage("docs/woman-sunglasses.jpg").effect(
  generativeReplace().from("sunglasses").to("black sunglasses")
);
```

```python
CloudinaryImage("docs/woman-sunglasses.jpg").image(effect="gen_replace:from_sunglasses;to_black sunglasses")
```

```php
(new ImageTag('docs/woman-sunglasses.jpg'))
	->effect(Effect::generativeReplace()->from("sunglasses")
->to("black sunglasses"));
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_replace:from_sunglasses;to_black sunglasses")).imageTag("docs/woman-sunglasses.jpg");
```

```ruby
cl_image_tag("docs/woman-sunglasses.jpg", effect: "gen_replace:from_sunglasses;to_black sunglasses")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_replace:from_sunglasses;to_black sunglasses")).BuildImageTag("docs/woman-sunglasses.jpg")
```

```dart
cloudinary.image('docs/woman-sunglasses.jpg').transformation(Transformation()
	.effect(Effect.generativeReplace().from("sunglasses")
.to("black sunglasses")));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_replace:from_sunglasses;to_black sunglasses")).generate("docs/woman-sunglasses.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_replace:from_sunglasses;to_black sunglasses")).generate("docs/woman-sunglasses.jpg");
```

```flutter
cloudinary.image('docs/woman-sunglasses.jpg').transformation(Transformation()
	.effect(Effect.generativeReplace().from("sunglasses")
.to("black sunglasses")));
```

```kotlin
cloudinary.image {
	publicId("docs/woman-sunglasses.jpg")
	 effect(Effect.generativeReplace() { from("sunglasses")
 to("black sunglasses") }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/woman-sunglasses.jpg", {effect: "gen_replace:from_sunglasses;to_black sunglasses"})
```

```react_native
new CloudinaryImage("docs/woman-sunglasses.jpg").effect(
  generativeReplace().from("sunglasses").to("black sunglasses")
);
```

Try it on your own images

### Generative restore

[Generative restore](generative_ai_transformations#generative_restore) uses AI to mend image imperfections like compression artifacts, noise, and blurriness. Through a two-step restoration process, it recovers lost details and refines the image, enhancing the clarity and quality of old or damaged photos and [user-generated content](user_generated_content).

![Restored image of girl with freckles](https://res.cloudinary.com/demo/image/upload/e_gen_restore/docs/freckles.png "with_image:false")

```nodejs
cloudinary.image("docs/freckles.png", {effect: "gen_restore"})
```

```react
new CloudinaryImage("docs/freckles.png").effect(generativeRestore());
```

```vue
new CloudinaryImage("docs/freckles.png").effect(generativeRestore());
```

```angular
new CloudinaryImage("docs/freckles.png").effect(generativeRestore());
```

```js
new CloudinaryImage("docs/freckles.png").effect(generativeRestore());
```

```python
CloudinaryImage("docs/freckles.png").image(effect="gen_restore")
```

```php
(new ImageTag('docs/freckles.png'))
	->effect(Effect::generativeRestore());
```

```java
cloudinary.url().transformation(new Transformation().effect("gen_restore")).imageTag("docs/freckles.png");
```

```ruby
cl_image_tag("docs/freckles.png", effect: "gen_restore")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("gen_restore")).BuildImageTag("docs/freckles.png")
```

```dart
cloudinary.image('docs/freckles.png').transformation(Transformation()
	.effect(Effect.generativeRestore()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("gen_restore")).generate("docs/freckles.png")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("gen_restore")).generate("docs/freckles.png");
```

```flutter
cloudinary.image('docs/freckles.png').transformation(Transformation()
	.effect(Effect.generativeRestore()));
```

```kotlin
cloudinary.image {
	publicId("docs/freckles.png")
	 effect(Effect.generativeRestore()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/freckles.png", {effect: "gen_restore"})
```

```react_native
new CloudinaryImage("docs/freckles.png").effect(generativeRestore());
```

Try it on your own images

Watch a video tutorial

#### How are our customers using generative restore? When buying clothing online, it's important to be able to see the detail in the fabric, but downscaling images can obscure that detail.  Using generative restore, you can deliver the right sized image, without compromising on quality.   

Here it is in action:

![Use case](https://res.cloudinary.com/cloudinary/video/upload/t_black_border/training/gen_restore_use "thumb:c_scale,w_600, poster:https://res.cloudinary.com/cloudinary/video/upload/t_black_border/so_28.0/training/gen_restore_use.jpg")

Here's the transformation on the image shown in the video:

![Photo of wedding dress detail with generative restore effect applied](https://res.cloudinary.com/demo/image/upload/c_scale,w_200/e_gen_restore/docs/wedding_fabric.jpg "with_image: false")

```nodejs
cloudinary.image("docs/wedding_fabric.jpg", {transformation: [
  {width: 200, crop: "scale"},
  {effect: "gen_restore"}
  ]})
```

```react
new CloudinaryImage("docs/wedding_fabric.jpg")
  .resize(scale().width(200))
  .effect(generativeRestore());
```

```vue
new CloudinaryImage("docs/wedding_fabric.jpg")
  .resize(scale().width(200))
  .effect(generativeRestore());
```

```angular
new CloudinaryImage("docs/wedding_fabric.jpg")
  .resize(scale().width(200))
  .effect(generativeRestore());
```

```js
new CloudinaryImage("docs/wedding_fabric.jpg")
  .resize(scale().width(200))
  .effect(generativeRestore());
```

```python
CloudinaryImage("docs/wedding_fabric.jpg").image(transformation=[
  {'width': 200, 'crop': "scale"},
  {'effect': "gen_restore"}
  ])
```

```php
(new ImageTag('docs/wedding_fabric.jpg'))
	->resize(Resize::scale()->width(200))
	->effect(Effect::generativeRestore());
```

```java
cloudinary.url().transformation(new Transformation()
  .width(200).crop("scale").chain()
  .effect("gen_restore")).imageTag("docs/wedding_fabric.jpg");
```

```ruby
cl_image_tag("docs/wedding_fabric.jpg", transformation: [
  {width: 200, crop: "scale"},
  {effect: "gen_restore"}
  ])
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation()
  .Width(200).Crop("scale").Chain()
  .Effect("gen_restore")).BuildImageTag("docs/wedding_fabric.jpg")
```

```dart
cloudinary.image('docs/wedding_fabric.jpg').transformation(Transformation()
	.resize(Resize.scale().width(200))
	.effect(Effect.generativeRestore()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()
  .setWidth(200).setCrop("scale").chain()
  .setEffect("gen_restore")).generate("docs/wedding_fabric.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation()
  .width(200).crop("scale").chain()
  .effect("gen_restore")).generate("docs/wedding_fabric.jpg");
```

```flutter
cloudinary.image('docs/wedding_fabric.jpg').transformation(Transformation()
	.resize(Resize.scale().width(200))
	.effect(Effect.generativeRestore()));
```

```kotlin
cloudinary.image {
	publicId("docs/wedding_fabric.jpg")
	 resize(Resize.scale() { width(200) })
	 effect(Effect.generativeRestore()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/wedding_fabric.jpg", {transformation: [
  {width: 200, crop: "scale"},
  {effect: "gen_restore"}
  ]})
```

```react_native
new CloudinaryImage("docs/wedding_fabric.jpg")
  .resize(scale().width(200))
  .effect(generativeRestore());
```

Normal downscaling

Downscaling withgenerative restore

## AI content analysis for transformations

### Content analysis for resizing and cropping

Smart cropping utilizes AI technology to intelligently focus on the most significant regions of [images](resizing_and_cropping#automatic_cropping_g_auto) and [videos](video_resizing_and_cropping#automatic_gravity_for_crops_g_auto), ensuring viewers receive an engaging visual experience irrespective of the device or browser used. By automating the cropping process, smart cropping not only enhances the visual appeal but also ensures that critical content is not lost, making the media more viewer-centric and adaptable to varying display requirements.

![Crop focusing on the woman](https://res.cloudinary.com/demo/video/upload/ar_3:4,c_fill,g_auto,h_300/docs/walking-woman.mp4 "with_image:false")

```nodejs
cloudinary.video("docs/walking-woman", {aspect_ratio: "3:4", gravity: "auto", height: 300, crop: "fill"})
```

```react
new CloudinaryVideo("docs/walking-woman.mp4").resize(
  fill()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity())
);
```

```vue
new CloudinaryVideo("docs/walking-woman.mp4").resize(
  fill()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity())
);
```

```angular
new CloudinaryVideo("docs/walking-woman.mp4").resize(
  fill()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity())
);
```

```js
new CloudinaryVideo("docs/walking-woman.mp4").resize(
  fill()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity())
);
```

```python
CloudinaryVideo("docs/walking-woman").video(aspect_ratio="3:4", gravity="auto", height=300, crop="fill")
```

```php
(new VideoTag('docs/walking-woman.mp4'))
	->resize(Resize::fill()->height(300)
->aspectRatio("3:4")
	->gravity(
	Gravity::autoGravity())
	);
```

```java
cloudinary.url().transformation(new Transformation().aspectRatio("3:4").gravity("auto").height(300).crop("fill")).videoTag("docs/walking-woman");
```

```ruby
cl_video_tag("docs/walking-woman", aspect_ratio: "3:4", gravity: "auto", height: 300, crop: "fill")
```

```csharp
cloudinary.Api.UrlVideoUp.Transform(new Transformation().AspectRatio("3:4").Gravity("auto").Height(300).Crop("fill")).BuildVideoTag("docs/walking-woman")
```

```dart
cloudinary.video('docs/walking-woman.mp4').transformation(Transformation()
	.resize(Resize.fill().height(300)
.aspectRatio("3:4")
	.gravity(
	Gravity.autoGravity())
	));
```

```swift
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setAspectRatio("3:4").setGravity("auto").setHeight(300).setCrop("fill")).generate("docs/walking-woman.mp4")
```

```android
MediaManager.get().url().transformation(new Transformation().aspectRatio("3:4").gravity("auto").height(300).crop("fill")).resourceType("video").generate("docs/walking-woman.mp4");
```

```flutter
cloudinary.video('docs/walking-woman.mp4').transformation(Transformation()
	.resize(Resize.fill().height(300)
.aspectRatio("3:4")
	.gravity(
	Gravity.autoGravity())
	));
```

```kotlin
cloudinary.video {
	publicId("docs/walking-woman.mp4")
	 resize(Resize.fill() { height(300)
 aspectRatio("3:4")
	 gravity(
	Gravity.autoGravity())
	 }) 
}.generate()
```

```jquery
$.cloudinary.video("docs/walking-woman", {aspect_ratio: "3:4", gravity: "auto", height: 300, crop: "fill"})
```

```react_native
new CloudinaryVideo("docs/walking-woman.mp4").resize(
  fill()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity())
);
```

Try it on your own videos

Watch a video tutorial

If you know what you expect to see in an image, you can use more specific content aware cropping, such as [object-detection based cropping](cloudinary_ai_content_analysis_addon#object_aware_cropping), [text-detection based cropping](ocr_text_detection_and_extraction_addon) or [face-detection based cropping](face_detection_based_transformations#face_detection_based_cropping), even to the level of [facial attributes](advanced_facial_attributes_detection_addon).

![Crop focusing on the woman](https://res.cloudinary.com/demo/image/upload/ar_3:4,c_auto,g_auto:face,h_300/docs/model.jpg "with_image:false")

```nodejs
cloudinary.image("docs/model.jpg", {aspect_ratio: "3:4", gravity: "auto:face", height: 300, crop: "auto"})
```

```react
new CloudinaryImage("docs/model.jpg").resize(
  auto()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity().autoFocus(focusOn(face())))
);
```

```vue
new CloudinaryImage("docs/model.jpg").resize(
  auto()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity().autoFocus(focusOn(face())))
);
```

```angular
new CloudinaryImage("docs/model.jpg").resize(
  auto()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity().autoFocus(focusOn(face())))
);
```

```js
new CloudinaryImage("docs/model.jpg").resize(
  auto()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity().autoFocus(focusOn(face())))
);
```

```python
CloudinaryImage("docs/model.jpg").image(aspect_ratio="3:4", gravity="auto:face", height=300, crop="auto")
```

```php
(new ImageTag('docs/model.jpg'))
	->resize(Resize::auto()->height(300)
->aspectRatio("3:4")
	->gravity(
	Gravity::autoGravity()
	->autoFocus(
	AutoFocus::focusOn(
	FocusOn::face()))
	)
	);
```

```java
cloudinary.url().transformation(new Transformation().aspectRatio("3:4").gravity("auto:face").height(300).crop("auto")).imageTag("docs/model.jpg");
```

```ruby
cl_image_tag("docs/model.jpg", aspect_ratio: "3:4", gravity: "auto:face", height: 300, crop: "auto")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().AspectRatio("3:4").Gravity("auto:face").Height(300).Crop("auto")).BuildImageTag("docs/model.jpg")
```

```dart
cloudinary.image('docs/model.jpg').transformation(Transformation()
	.resize(Resize.auto().height(300)
.aspectRatio("3:4")
	.gravity(
	Gravity.autoGravity()
	.autoFocus(
	AutoFocus.focusOn(
	FocusOn.face()))
	)
	));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setAspectRatio("3:4").setGravity("auto:face").setHeight(300).setCrop("auto")).generate("docs/model.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().aspectRatio("3:4").gravity("auto:face").height(300).crop("auto")).generate("docs/model.jpg");
```

```flutter
cloudinary.image('docs/model.jpg').transformation(Transformation()
	.resize(Resize.auto().height(300)
.aspectRatio("3:4")
	.gravity(
	Gravity.autoGravity()
	.autoFocus(
	AutoFocus.focusOn(
	FocusOn.face()))
	)
	));
```

```kotlin
cloudinary.image {
	publicId("docs/model.jpg")
	 resize(Resize.auto() { height(300)
 aspectRatio("3:4")
	 gravity(
	Gravity.autoGravity() {
	 autoFocus(
	AutoFocus.focusOn(
	FocusOn.face()))
	 })
	 }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/model.jpg", {aspect_ratio: "3:4", gravity: "auto:face", height: 300, crop: "auto"})
```

```react_native
new CloudinaryImage("docs/model.jpg").resize(
  auto()
    .height(300)
    .aspectRatio("3:4")
    .gravity(autoGravity().autoFocus(focusOn(face())))
);
```

Try it on your own images

Watch a video tutorial

The [upscale](resizing_and_cropping#upscaling_with_super_resolution) transformation utilizes super resolution to enhance the quality of images when upscaling them, making low-resolution images appear clearer and sharper. This is particularly useful when high-resolution images are required but only lower-resolution images are available. The transformation improves image details, making them suitable for various uses without compromising on visual quality.

![Upscaled fried egg](https://res.cloudinary.com/demo/image/upload/e_upscale/docs/fried-egg.jpg "with_image:false")

```nodejs
cloudinary.image("docs/fried-egg.jpg", {effect: "upscale"})
```

```react
new CloudinaryImage("docs/fried-egg.jpg").effect(upscale());
```

```vue
new CloudinaryImage("docs/fried-egg.jpg").effect(upscale());
```

```angular
new CloudinaryImage("docs/fried-egg.jpg").effect(upscale());
```

```js
new CloudinaryImage("docs/fried-egg.jpg").effect(upscale());
```

```python
CloudinaryImage("docs/fried-egg.jpg").image(effect="upscale")
```

```php
(new ImageTag('docs/fried-egg.jpg'))
	->effect(Effect::upscale());
```

```java
cloudinary.url().transformation(new Transformation().effect("upscale")).imageTag("docs/fried-egg.jpg");
```

```ruby
cl_image_tag("docs/fried-egg.jpg", effect: "upscale")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("upscale")).BuildImageTag("docs/fried-egg.jpg")
```

```dart
cloudinary.image('docs/fried-egg.jpg').transformation(Transformation()
	.effect(Effect.upscale()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("upscale")).generate("docs/fried-egg.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("upscale")).generate("docs/fried-egg.jpg");
```

```flutter
cloudinary.image('docs/fried-egg.jpg').transformation(Transformation()
	.effect(Effect.upscale()));
```

```kotlin
cloudinary.image {
	publicId("docs/fried-egg.jpg")
	 effect(Effect.upscale()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/fried-egg.jpg", {effect: "upscale"})
```

```react_native
new CloudinaryImage("docs/fried-egg.jpg").effect(upscale());
```

Try it on your own images

Watch a video tutorial

### Content analysis for enhancing images

[AI image enhancement](transformation_reference#e_enhance) harnesses AI to automatically analyze and improve image quality. Key features include correcting overexposure, enhancing underexposed areas, intensifying colors, and adjusting color temperature for a balanced, vibrant, and true-to-life visual experience. This effect seamlessly enhances image appeal while maintaining natural quality, ideal for refining visual content across diverse applications.

![Bedroom](https://res.cloudinary.com/demo/image/upload/e_enhance/docs/bedroom.jpg "with_image:false")

```nodejs
cloudinary.image("docs/bedroom.jpg", {effect: "enhance"})
```

```react
new CloudinaryImage("docs/bedroom.jpg").effect(enhance());
```

```vue
new CloudinaryImage("docs/bedroom.jpg").effect(enhance());
```

```angular
new CloudinaryImage("docs/bedroom.jpg").effect(enhance());
```

```js
new CloudinaryImage("docs/bedroom.jpg").effect(enhance());
```

```python
CloudinaryImage("docs/bedroom.jpg").image(effect="enhance")
```

```php
(new ImageTag('docs/bedroom.jpg'))
	->effect(Effect::enhance());
```

```java
cloudinary.url().transformation(new Transformation().effect("enhance")).imageTag("docs/bedroom.jpg");
```

```ruby
cl_image_tag("docs/bedroom.jpg", effect: "enhance")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("enhance")).BuildImageTag("docs/bedroom.jpg")
```

```dart
cloudinary.image('docs/bedroom.jpg').transformation(Transformation()
	.effect(Effect.enhance()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("enhance")).generate("docs/bedroom.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("enhance")).generate("docs/bedroom.jpg");
```

```flutter
cloudinary.image('docs/bedroom.jpg').transformation(Transformation()
	.effect(Effect.enhance()));
```

```kotlin
cloudinary.image {
	publicId("docs/bedroom.jpg")
	 effect(Effect.enhance()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/bedroom.jpg", {effect: "enhance"})
```

```react_native
new CloudinaryImage("docs/bedroom.jpg").effect(enhance());
```

Try it on your own images

Watch a video tutorial

### Content analysis for displaying product images

The [background removal](background_removal) transformation dynamically extracts the foreground subject in images while removing the background on the fly. This is useful for creating uniform product images, or isolating subjects from distracting backgrounds.

![Woman in the foreground](https://res.cloudinary.com/demo/image/upload/e_background_removal/docs/guitar.jpg "with_image:false")

```nodejs
cloudinary.image("docs/guitar.jpg", {effect: "background_removal"})
```

```react
new CloudinaryImage("docs/guitar.jpg").effect(backgroundRemoval());
```

```vue
new CloudinaryImage("docs/guitar.jpg").effect(backgroundRemoval());
```

```angular
new CloudinaryImage("docs/guitar.jpg").effect(backgroundRemoval());
```

```js
new CloudinaryImage("docs/guitar.jpg").effect(backgroundRemoval());
```

```python
CloudinaryImage("docs/guitar.jpg").image(effect="background_removal")
```

```php
(new ImageTag('docs/guitar.jpg'))
	->effect(Effect::backgroundRemoval());
```

```java
cloudinary.url().transformation(new Transformation().effect("background_removal")).imageTag("docs/guitar.jpg");
```

```ruby
cl_image_tag("docs/guitar.jpg", effect: "background_removal")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("background_removal")).BuildImageTag("docs/guitar.jpg")
```

```dart
cloudinary.image('docs/guitar.jpg').transformation(Transformation()
	.effect(Effect.backgroundRemoval()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("background_removal")).generate("docs/guitar.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("background_removal")).generate("docs/guitar.jpg");
```

```flutter
cloudinary.image('docs/guitar.jpg').transformation(Transformation()
	.effect(Effect.backgroundRemoval()));
```

```kotlin
cloudinary.image {
	publicId("docs/guitar.jpg")
	 effect(Effect.backgroundRemoval()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/guitar.jpg", {effect: "background_removal"})
```

```react_native
new CloudinaryImage("docs/guitar.jpg").effect(backgroundRemoval());
```

Try it on your own images

Watch a video tutorial

The [drop shadow](effects_and_artistic_enhancements#dropshadow_effect) effect employs AI to apply realistic shadows to objects within an image, which is useful especially for product images where background removal has been used. By specifying the light source position and spread, you can control the appearance of the shadow, creating a more natural or dramatic effect as needed. This effect enhances the visual depth and distinction of images.

![Blue car with drop shadow](https://res.cloudinary.com/demo/image/upload/e_background_removal/e_dropshadow/docs/blue-car.png "with_image:false")

```nodejs
cloudinary.image("docs/blue-car.png", {transformation: [
  {effect: "background_removal"},
  {effect: "dropshadow"}
  ]})
```

```react
new CloudinaryImage("docs/blue-car.png")
  .effect(backgroundRemoval())
  .effect(dropShadow());
```

```vue
new CloudinaryImage("docs/blue-car.png")
  .effect(backgroundRemoval())
  .effect(dropShadow());
```

```angular
new CloudinaryImage("docs/blue-car.png")
  .effect(backgroundRemoval())
  .effect(dropShadow());
```

```js
new CloudinaryImage("docs/blue-car.png")
  .effect(backgroundRemoval())
  .effect(dropShadow());
```

```python
CloudinaryImage("docs/blue-car.png").image(transformation=[
  {'effect': "background_removal"},
  {'effect': "dropshadow"}
  ])
```

```php
(new ImageTag('docs/blue-car.png'))
	->effect(Effect::backgroundRemoval())
	->effect(Effect::dropShadow());
```

```java
cloudinary.url().transformation(new Transformation()
  .effect("background_removal").chain()
  .effect("dropshadow")).imageTag("docs/blue-car.png");
```

```ruby
cl_image_tag("docs/blue-car.png", transformation: [
  {effect: "background_removal"},
  {effect: "dropshadow"}
  ])
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation()
  .Effect("background_removal").Chain()
  .Effect("dropshadow")).BuildImageTag("docs/blue-car.png")
```

```dart
cloudinary.image('docs/blue-car.png').transformation(Transformation()
	.effect(Effect.backgroundRemoval())
	.effect(Effect.dropShadow()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation()
  .setEffect("background_removal").chain()
  .setEffect("dropshadow")).generate("docs/blue-car.png")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation()
  .effect("background_removal").chain()
  .effect("dropshadow")).generate("docs/blue-car.png");
```

```flutter
cloudinary.image('docs/blue-car.png').transformation(Transformation()
	.effect(Effect.backgroundRemoval())
	.effect(Effect.dropShadow()));
```

```kotlin
cloudinary.image {
	publicId("docs/blue-car.png")
	 effect(Effect.backgroundRemoval())
	 effect(Effect.dropShadow()) 
}.generate()
```

```jquery
$.cloudinary.image("docs/blue-car.png", {transformation: [
  {effect: "background_removal"},
  {effect: "dropshadow"}
  ]})
```

```react_native
new CloudinaryImage("docs/blue-car.png")
  .effect(backgroundRemoval())
  .effect(dropShadow());
```

Try it on your own images

Watch a video tutorial

### Content analysis for extracting components of an image

Powered by AI, the [extract](effects_and_artistic_enhancements#use_ai_to_determine_what_to_remove_or_keep_in_an_image) effect makes it easy to isolate specific parts of an image using simple natural language prompts. Whether you want to highlight a product by removing the background or get creative by focusing on specific elements, this transformation does the work for you. Just state what you want to keep (or remove), and let the magic happen! 

![Ski equipment with green skis removed](https://res.cloudinary.com/demo/image/upload/e_extract:prompt_the%20green%20skis;multiple_true;invert_true/docs/ski-equipment.jpg "with_image:false")

```nodejs
cloudinary.image("docs/ski-equipment.jpg", {effect: "extract:prompt_the green skis;multiple_true;invert_true"})
```

```react
new CloudinaryImage("docs/ski-equipment.jpg").effect(
  extract("the green skis").detectMultiple().invert()
);
```

```vue
new CloudinaryImage("docs/ski-equipment.jpg").effect(
  extract("the green skis").detectMultiple().invert()
);
```

```angular
new CloudinaryImage("docs/ski-equipment.jpg").effect(
  extract("the green skis").detectMultiple().invert()
);
```

```js
new CloudinaryImage("docs/ski-equipment.jpg").effect(
  extract("the green skis").detectMultiple().invert()
);
```

```python
CloudinaryImage("docs/ski-equipment.jpg").image(effect="extract:prompt_the green skis;multiple_True;invert_True")
```

```php
(new ImageTag('docs/ski-equipment.jpg'))
	->effect(Effect::extract("the green skis")->detectMultiple()
->invert());
```

```java
cloudinary.url().transformation(new Transformation().effect("extract:prompt_the green skis;multiple_true;invert_true")).imageTag("docs/ski-equipment.jpg");
```

```ruby
cl_image_tag("docs/ski-equipment.jpg", effect: "extract:prompt_the green skis;multiple_true;invert_true")
```

```csharp
cloudinary.Api.UrlImgUp.Transform(new Transformation().Effect("extract:prompt_the green skis;multiple_true;invert_true")).BuildImageTag("docs/ski-equipment.jpg")
```

```dart
cloudinary.image('docs/ski-equipment.jpg').transformation(Transformation()
	.effect(Effect.extract("the green skis").detectMultiple()
.invert()));
```

```swift
imageView.cldSetImage(cloudinary.createUrl().setTransformation(CLDTransformation().setEffect("extract:prompt_the green skis;multiple_true;invert_true")).generate("docs/ski-equipment.jpg")!, cloudinary: cloudinary)
```

```android
MediaManager.get().url().transformation(new Transformation().effect("extract:prompt_the green skis;multiple_true;invert_true")).generate("docs/ski-equipment.jpg");
```

```flutter
cloudinary.image('docs/ski-equipment.jpg').transformation(Transformation()
	.effect(Effect.extract("the green skis").detectMultiple()
.invert()));
```

```kotlin
cloudinary.image {
	publicId("docs/ski-equipment.jpg")
	 effect(Effect.extract("the green skis") { detectMultiple()
 invert() }) 
}.generate()
```

```jquery
$.cloudinary.image("docs/ski-equipment.jpg", {effect: "extract:prompt_the green skis;multiple_true;invert_true"})
```

```react_native
new CloudinaryImage("docs/ski-equipment.jpg").effect(
  extract("the green skis").detectMultiple().invert()
);
```

Try it on your own images

### Content analysis for video previews

The [AI-based video preview](video_effects_and_enhancements#ai_based_video_preview) transformation effect generates video previews automatically by activating deep learning algorithms that identify the most interesting video segments. You can optionally control the length of the generated preview, and the number and duration of the video segments. Video previews can be used to engage your audience and help them select the video content that interests them.

![Preview of a rocket launch](https://res.cloudinary.com/demo/video/upload/e_preview:duration_12:max_seg_4:min_seg_dur_3/rocket_launch "with_image:false")

```nodejs
cloudinary.image("rocket_launch", {effect: "preview:duration_12:max_seg_4:min_seg_dur_3", resource_type: "video"})
```

```react
new CloudinaryVideo("rocket_launch").videoEdit(
  preview().duration("12.0").maximumSegments(4).minimumSegmentDuration("3.0")
);
```

```vue
new CloudinaryVideo("rocket_launch").videoEdit(
  preview().duration("12.0").maximumSegments(4).minimumSegmentDuration("3.0")
);
```

```angular
new CloudinaryVideo("rocket_launch").videoEdit(
  preview().duration("12.0").maximumSegments(4).minimumSegmentDuration("3.0")
);
```

```js
new CloudinaryVideo("rocket_launch").videoEdit(
  preview().duration("12.0").maximumSegments(4).minimumSegmentDuration("3.0")
);
```

```python
CloudinaryVideo("rocket_launch").image(effect="preview:duration_12:max_seg_4:min_seg_dur_3")
```

```php
(new VideoTag('rocket_launch'))
	->videoEdit(VideoEdit::preview()->duration(12.0)
->maximumSegments(4)
->minimumSegmentDuration(3.0));
```

```java
cloudinary.url().transformation(new Transformation().effect("preview:duration_12:max_seg_4:min_seg_dur_3")).resourceType("video").imageTag("rocket_launch");
```

```ruby
cl_image_tag("rocket_launch", effect: "preview:duration_12:max_seg_4:min_seg_dur_3", resource_type: "video")
```

```csharp
cloudinary.Api.UrlVideoUp.Transform(new Transformation().Effect("preview:duration_12:max_seg_4:min_seg_dur_3")).BuildImageTag("rocket_launch")
```

```dart
cloudinary.video('rocket_launch').transformation(Transformation()
	.videoEdit(VideoEdit.preview().duration('12.0')
.maximumSegments(4)
.minimumSegmentDuration('3.0')));
```

```swift
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation().setEffect("preview:duration_12:max_seg_4:min_seg_dur_3")).generate("rocket_launch")
```

```android
MediaManager.get().url().transformation(new Transformation().effect("preview:duration_12:max_seg_4:min_seg_dur_3")).resourceType("video").generate("rocket_launch");
```

```flutter
cloudinary.video('rocket_launch').transformation(Transformation()
	.videoEdit(VideoEdit.preview().duration('12.0')
.maximumSegments(4)
.minimumSegmentDuration('3.0')));
```

```kotlin
cloudinary.video {
	publicId("rocket_launch")
	 videoEdit(VideoEdit.preview() { duration(12.0F)
 maximumSegments(4)
 minimumSegmentDuration(3.0F) }) 
}.generate()
```

```jquery
$.cloudinary.image("rocket_launch", {effect: "preview:duration_12:max_seg_4:min_seg_dur_3", resource_type: "video"})
```

```react_native
new CloudinaryVideo("rocket_launch").videoEdit(
  preview().duration("12.0").maximumSegments(4).minimumSegmentDuration("3.0")
);
```

Try it on your own videos

## AI content analysis for management

### Content analysis for auto-tagging

Tagging your assets makes them easier to organize and find, but manually tagging your assets can be a tedious and time-consuming task. 
There are various auto-tagging add-ons available that automatically add tags to your assets on or after upload to your product environment. Some of the add-ons have broad tagging capabilities, such as the [Amazon Rekognition](aws_rekognition_auto_tagging_addon), [Google Image](google_auto_tagging_addon), and [Imagga](imagga_auto_tagging_addon) auto-tagging add-ons for images, and the [Google Video](google_automatic_video_tagging_addon) and [Microsoft Azure Video Indexer](microsoft_azure_video_indexer_addon#video_categorization) auto-tagging add-ons for videos. You can use these add-ons in conjunction with the [Google Translation add-on](translation_addons) to translate your tags to different languages.

Others are more specific in terms of what they detect, for example you can use the [Amazon Rekognition Celebrity Detection add-on](aws_rekognition_celebrity_and_face_detection_addon) to detect celebrities, or the [Cloudinary AI Content Analysis add-on](cloudinary_ai_content_analysis_addon#automatic_image_tagging) to detect objects in a specific object model.

You can also try out the [Cloudinary AI Vision add-on](cloudinary_ai_vision_addon) to interpret and respond to visual content queries. This is particularly useful for determining if user-generated content is suitable for your site as you can be very specific in what you allow or reject based on components of the image.

```multi
|ruby
Cloudinary::Uploader.upload("lady-walking.mp4", 
  resource_type: "video", 
  categorization: "google_video_tagging", 
  auto_tagging: 0.4)

|php_2
$cloudinary->uploadApi()->upload("lady-walking.mp4", [
    "resource_type" => "video",
    "categorization" => "google_video_tagging", 
    "auto_tagging" => 0.4]);

|python
cloudinary.uploader.upload("lady-walking.mp4",
  resource_type = "video",
  categorization = "google_video_tagging", 
  auto_tagging = 0.4)

|nodejs
cloudinary.v2.uploader
.upload("lady-walking.mp4", 
  { resource_type: "video", 
    categorization: "google_video_tagging", 
    auto_tagging: 0.4 })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("lady-walking.mp4", 
  ObjectUtils.asMap(
    "resource_type", "video", 
    "categorization", "google_video_tagging", 
    "auto_tagging", "0.4"));

|csharp
var uploadParams = new VideoUploadParams() 
{
  File = new FileDescription(@"lady-walking.mp4"),
  Categorization = "google_video_tagging",
  AutoTagging = 0.4
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "lady-walking.mp4", uploader.UploadParams{
		ResourceType:   "video",
		Categorization: "google_video_tagging",
		AutoTagging:    0.4})

|android
MediaManager.get().upload("lady-walking.mp4")
  .option("resource_type", "video")
  .option("categorization", "google_video_tagging")
  .option("auto_tagging", "0.4").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setCategorization("google_video_tagging")
  .setResourceType(.video)
  .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: "lady-walking.mp4", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/video/upload -X POST -F 'file=@/path/to/lady-walking.mp4' -F 'categorization=google_video_tagging' -F 'auto_tagging=0.4' -F 'timestamp=173719931' -F 'api_key=436464676&signature=a781d61f86a6f818af'

|cli
cld uploader upload "lady-walking.mp4" resource_type="video" categorization="google_video_tagging" auto_tagging=0.4
```

```json
"notification_type": "info",
  "info_data": [
    {
      "tag": "clothing",
      "categories": [],
      "start_time_offset": 0,
      "end_time_offset": 0,
      "confidence": 0.9483920931816101,
      "shot_level": false
    },
    {
      "tag": "facial expression",
      "categories": [
        "person"
      ],
      "start_time_offset": 0,
      "end_time_offset": 0,
      "confidence": 0.9378005862236023,
      "shot_level": false
    },
    {
      "tag": "pattern",
      "categories": [
        "design"
      ],
      "start_time_offset": 0,
      "end_time_offset": 0,
      "confidence": 0.5210643410682678,
      "shot_level": false
    },
    ...
```

Watch a video tutorial

### Content analysis for Visual Search

Tags are incredibly useful when it comes to searching for assets, but there's another powerful AI capability for searching - [Visual Search](visual_search). Either use text to describe what you're searching for, or an image similar to what you're looking for.  Visual Search looks at the visual content of images, rather than their public ID or metadata. 

```multi      
|ruby
Cloudinary::Api.visual_search(image_url: "https://www.example.com/coffee.jpg")

|php_2
$api->visualSearch("ImageUrl" => "https://www.example.com/coffee.jpg");

|python
cloudinary.api.visual_search(image_url = "https://www.example.com/coffee.jpg")

|nodejs
cloudinary.v2.api.visual_search({image_url: "https://www.example.com/coffee.jpg"}).then(callback);

|java
cloudinary.api().visualSearch(ObjectUtils.asMap(
  "image_url", "https://www.example.com/coffee.jpg"
));

|csharp
var info = cloudinary.VisualSearch(new VisualSearchParams{
  ImageUrl = "https://www.example.com/coffee.jpg"
});

|go
resp, err := cld.Admin.VisualSearch(ctx, admin.VisualSearchParams{
  ImageUrl: "https://www.example.com/coffee.jpg"
})

|cli
cld admin visual_search image_url="https://www.example.com/coffee.jpg"

|curl
curl https://<API_KEY>:<API_SECRET>@api.cloudinary.com/v1_1/<cloud_name>/resources/visual_search?image_url="https://www.example.com/coffee.jpg"
```

```json
{
  "next_cursor": "a36b8bd80426df43a107f26b0348",
  "resources": [
  {
    "asset_id": "5f9d30acd36ac3c4f48a82241a37a299",
    "public_id": "coffee-on-table",
     …
  },
  {
    "asset_id": "191ad30acd36acf48a82241a137a299a",
    "public_id": "coffee-turquoise-cup",
     …
  }
  …
}
```

### Content analysis for image captioning

The Cloudinary AI Content Analysis add-on can also be used for [AI-based image captioning](cloudinary_ai_content_analysis_addon#ai_based_image_captioning), whereby an image is analyzed and a caption is suggested based on the images' contents. You can use this for image metadata or as the alt text for an image, improving your website's accessibility.

```multi
|ruby
Cloudinary::Uploader.upload("man-on-rock.jpg", 
  detection: "captioning")

|php_2
$cloudinary->uploadApi()->upload("man-on-rock.jpg", 
  ["detection" => "captioning"]);

|python
cloudinary.uploader.upload("man-on-rock.jpg",
  detection = "captioning")

|nodejs
cloudinary.v2.uploader
.upload("man-on-rock.jpg", 
  { detection: "captioning" })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("man-on-rock.jpg", ObjectUtils.asMap(
  "detection", "captioning"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"man-on-rock.jpg"),
  Detection = "captioning"
};
var uploadResult = cloudinary.Upload(uploadParams); 

|go
resp, err := cld.Upload.Upload(ctx, "man-on-rock.jpeg", uploader.UploadParams{
        Detection: "captioning"})

|android
MediaManager.get().upload("man-on-rock.jpg")
  .option("detection", "captioning").dispatch();

|swift
let params = CLDUploadRequestParams().setDetection("captioning")
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: "man-on-rock.jpg", params: params) 

|cli
cld uploader upload "man-on-rock.jpg" detection="captioning"

|curl
curl https://api.cloudinary.com/v1_1/demo/image/upload -X POST -F 'file=@/path/to/man-on-rock.jpg' -F 'detection=captioning' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'
```

```json
{
  "asset_id": "a30dc93a8580b272f05db9f3d47dbeab",
  "public_id": "1mqow1pnmgfxkkoackdp",
  ...
  "info": {
    "detection": {
      "captioning": {
        "status": "complete",
        "data": {
           "caption": "A man wearing a hat sitting on a rock looking out at the ocean with a rock formation in the distance near sunset or sunrise"
        },
        "model_version": 1.0,
        "schema_version": 1.0
      }
    }
  },
  "original_filename": "man-on-rock"
  ...  
}
```

Watch a video tutorial

### Content analysis for moderating assets

Cloudinary offers various add-ons offer advanced content moderation, enabling businesses to maintain a safe and compliant online environment for their users. 
* The [Amazon Rekognition AI Moderation add-on](aws_rekognition_ai_moderation_addon) leverages Amazon Rekognition's AI to automatically identify and moderate potentially unsafe content in images, suitable for social media platforms and e-commerce websites. 

* The [Amazon Rekognition Video Moderation add-on](aws_rekognition_video_moderation_addon) specializes in video content moderation for video-sharing platforms, ensuring live-streamed and pre-recorded videos comply with guidelines. 

* The [Google AI Video Moderation add-on](google_ai_video_moderation_addon) employs Google's AI technology to assess and moderate user-generated videos, ideal for video-hosting services. 

* The [WebPurify Image Moderation add-on](webpurify_image_moderation_addon) automatically filters out inappropriate images in real-time across various platforms, from social media to e-commerce websites, ensuring adherence to content guidelines and legal standards.
These add-ons collectively empower businesses to automate content moderation, saving time and resources, while also ensuring that their online spaces remain compliant and user-friendly by preventing the dissemination of harmful or inappropriate content.

```multi
|ruby
Cloudinary::Uploader.upload("local_file.jpg", 
  moderation: "aws_rek")
  
|php_2
$cloudinary->uploadApi()->upload("local_file.jpg", 
  ["moderation" => "aws_rek"]);

|python
cloudinary.uploader.upload("local_file.jpg",
  moderation = "aws_rek")
      
|nodejs
cloudinary.v2.uploader
.upload("local_file.jpg", 
  {moderation: "aws_rek"})
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("local_file.jpg", 
  ObjectUtils.asMap("moderation", "aws_rek"));

|csharp
var uploadParams = new ImageUploadParams() 
{
  File = new FileDescription(@"local_file.jpg"),
  Moderation = "aws_rek"
};
var uploadResult = cloudinary.Upload(uploadParams); 

|go
resp, err := cld.Upload.Upload(ctx, "local_file.jpg", uploader.UploadParams{
    Moderation: "aws_rek"})

|android
MediaManager.get().upload("local_file.jpg")
  .option("moderation", "aws_rek").dispatch();

|swift
let params = CLDUploadRequestParams().setModeration("aws_rek")
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: "local_file.jpg", params: params)

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

|cli
cld uploader upload "local_file.jpg" moderation="aws_rek"
```

```json
{
...
 "moderation": 
  [{"response": 
     {"moderation_labels": 
       [{"confidence": 94.9907455444336,
         "name": "Violence",
         "parent_name": ""},
        {"confidence": 94.9907455444336,
         "name": "Physical Violence",
         "parent_name": "Violence"}]},
    "status": "rejected",
    "kind": "aws_rek",
    "updated_at": "2023-08-03T08:26:58Z"}],
 ...
}
```

## AI video playback features

### Transcription services

Save time and resources transcribing videos in almost any language with the [Google AI Video Transcription](google_ai_video_transcription_addon) or the [Microsoft Azure Video Indexer](microsoft_azure_video_indexer_addon#video_transcription) add-ons.  These add-ons automatically transcribe spoken words in video content, making them an excellent choice for media companies, e-learning platforms, and businesses needing accurate video transcriptions for accessibility and SEO optimization. 

```multi
|ruby
Cloudinary::Uploader.upload("lincoln.mp4", 
  resource_type: "video", 
  raw_convert: "google_speech")

|php_2
$cloudinary->uploadApi()->upload("lincoln.mp4", [
    "resource_type" => "video", 
    "raw_convert" => "google_speech"]);

|python
cloudinary.uploader.upload("lincoln.mp4",
  resource_type = "video", 
  raw_convert = "google_speech")

|nodejs
cloudinary.v2.uploader
.upload("lincoln.mp4", 
  { resource_type: "video", 
    raw_convert: "google_speech" })
.then(result=>console.log(result)); 

|java
cloudinary.uploader().upload("lincoln.mp4", 
  ObjectUtils.asMap(
    "resource_type", "video", 
    "raw_convert", "google_speech"));

|csharp
var uploadParams = new VideoUploadParams()
{
  File = new FileDescription(@"lincoln.mp4"),
  RawConvert = "google_speech"
};
var uploadResult = cloudinary.Upload(uploadParams);  

|go
resp, err := cld.Upload.Upload(ctx, "lincoln.mp4", uploader.UploadParams{
		ResourceType: "video",
		RawConvert:   "google_speech"})

|android
MediaManager.get().upload("lincoln.mp4")
  .option("resource_type", "video")
  .option("raw_convert", "google_speech").dispatch();

|swift
let params = CLDUploadRequestParams()
  .setResourceType(.video)
  .setRawConvert("google_speech")
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: "lincoln.mp4", params: params) 

|curl
curl https://api.cloudinary.com/v1_1/demo/video/upload -X POST -F 'file=@/path/to/lincoln.mp4' -F 'raw_convert=google_speech' -F 'timestamp=173719931' -F 'api_key=436464676' -F 'signature=a781d61f86a6f818af'

|cli
cld uploader upload "lincoln.mp4" resource_type="video" raw_convert="google_speech"
```

![Display automatically generated subtitles on the video using the Google transcription add-on](https://res.cloudinary.com/demo/video/upload/l_subtitles:lincoln.transcript/fl_layer_apply/lincoln.mp4 "with_image: false")

```nodejs
cloudinary.video("lincoln", {transformation: [
  {overlay: {resource_type: "subtitles", public_id: "lincoln.transcript"}},
  {flags: "layer_apply"}
  ]})
```

```react
new CloudinaryVideo("lincoln.mp4").overlay(
  source(subtitles("lincoln.transcript"))
);
```

```vue
new CloudinaryVideo("lincoln.mp4").overlay(
  source(subtitles("lincoln.transcript"))
);
```

```angular
new CloudinaryVideo("lincoln.mp4").overlay(
  source(subtitles("lincoln.transcript"))
);
```

```js
new CloudinaryVideo("lincoln.mp4").overlay(
  source(subtitles("lincoln.transcript"))
);
```

```python
CloudinaryVideo("lincoln").video(transformation=[
  {'overlay': {'resource_type': "subtitles", 'public_id': "lincoln.transcript"}},
  {'flags': "layer_apply"}
  ])
```

```php
(new VideoTag('lincoln.mp4'))
	->overlay(Overlay::source(
	Source::subtitles("lincoln.transcript")));
```

```java
cloudinary.url().transformation(new Transformation()
  .overlay(new SubtitlesLayer().publicId("lincoln.transcript")).chain()
  .flags("layer_apply")).videoTag("lincoln");
```

```ruby
cl_video_tag("lincoln", transformation: [
  {overlay: {resource_type: "subtitles", public_id: "lincoln.transcript"}},
  {flags: "layer_apply"}
  ])
```

```csharp
cloudinary.Api.UrlVideoUp.Transform(new Transformation()
  .Overlay(new SubtitlesLayer().PublicId("lincoln.transcript")).Chain()
  .Flags("layer_apply")).BuildVideoTag("lincoln")
```

```dart
cloudinary.video('lincoln.mp4').transformation(Transformation()
	.overlay(Overlay.source(
	Source.subtitles("lincoln.transcript"))));
```

```swift
cloudinary.createUrl().setResourceType("video").setTransformation(CLDTransformation()
  .setOverlay("subtitles:lincoln.transcript").chain()
  .setFlags("layer_apply")).generate("lincoln.mp4")
```

```android
MediaManager.get().url().transformation(new Transformation()
  .overlay(new SubtitlesLayer().publicId("lincoln.transcript")).chain()
  .flags("layer_apply")).resourceType("video").generate("lincoln.mp4");
```

```flutter
cloudinary.video('lincoln.mp4').transformation(Transformation()
	.overlay(Overlay.source(
	Source.subtitles("lincoln.transcript"))));
```

```kotlin
cloudinary.video {
	publicId("lincoln.mp4")
	 overlay(Overlay.source(
	Source.subtitles("lincoln.transcript"))) 
}.generate()
```

```jquery
$.cloudinary.video("lincoln", {transformation: [
  {overlay: new cloudinary.SubtitlesLayer().publicId("lincoln.transcript")},
  {flags: "layer_apply"}
  ]})
```

```react_native
new CloudinaryVideo("lincoln.mp4").overlay(
  source(subtitles("lincoln.transcript"))
);
```

### AI-based highlights

The [Video Player AI-based highlights graph](video_player_customization#customize_seek_bar_functionality) shows a visual representation of the highlights of the video based on how our AI preview algorithm determines the level of interest for each part of the video. Hover over the timeline in the video to see it.

```js
const cld = cloudinary.videoPlayer('demo-player', {aiHighlightsGraph: true});
```

