> ## Documentation Index
> This page is part of the Image and Video APIs product. Fetch the complete documentation index for Image and Video APIs at: https://cloudinary.com/documentation/llms-image-and-video-apis.txt?referrer=docpage and then use it to discover all relevant pages before exploring further.
> If your task extends beyond this product, fetch the top-level index covering all Cloudinary products and topics at: https://cloudinary.com/documentation/llms.txt?referrer=docpage

# Next.js image optimization and dynamic cropping (video tutorial)


## Overview

Learn how to optimize and dynamically crop images in a Next.js application using the [CldImage](nextjs_image_transformations) component from the [Next.js SDK](nextjs_integration). This tutorial shows how replacing the standard Next.js Image component with CldImage avoids double optimization, automatically applies the best format and quality settings, and unlocks Cloudinary features like dynamic cropping and resizing.

## Video tutorial

  This video is brought to you by Cloudinary's video player - embed your own!Use the controls to set the playback speed, navigate to chapters of interest and select subtitles in your preferred language.
{videoTranscript:publicId=training/Next_Cloudinary_-_CldImage}

## Tutorial contents
This tutorial presents the following topics. Click a timestamp to jump to that part of the video.### Why use Next Cloudinary
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Next.js has built-in ways to load images, but if you're already using Cloudinary, passing optimized images through the Next.js Image component means double optimization. The [Next.js SDK](nextjs_integration) gives you all the features of Cloudinary directly in your Next.js app without the redundancy. |

### Installing and replacing the Image tag
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Once the Next.js SDK is installed and you've imported the [CldImage](nextjs_image_transformations) component, replace the existing Next.js Image tag with CldImage. Instead of referencing the full Cloudinary URL, pass in only the public ID to load images directly from Cloudinary. |

### Automatic optimization
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | By default, CldImage loads all images with [f_auto and q_auto](image_optimization#how_to_optimize_image_quality). With f_auto, Cloudinary automatically determines the most modern and efficient format for the requesting browser. With q_auto, it compresses the image as much as possible without visible distortion. |

### Responsive image sizing
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Because CldImage wraps the Next.js Image component, responsive sizing works the same way. Pass in sizes (e.g., `50vw` for a two-column layout) and all responsive breakpoints are generated using Cloudinary URLs. |

### Dynamic cropping and resizing
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Use Cloudinary's [dynamic cropping](resizing_and_cropping) to make images uniform. Set a width and height, and use `crop="fill"` to fill the dimensions. Automatic gravity is applied by the SDK, so you don't need to worry about your displayed images missing important content. |

### Learn more and review
{table:class=tutorial-bullets}|  | 
| --- | --- |
| | Visit the [Next.js SDK documentation](nextjs_integration) for configuration details and examples including background removal and more. In summary, the CldImage component gives you optimization, dynamic cropping, and resizing, all delivered from the Cloudinary CDN. |

## Keep learning

> **READING**:
>
> * Learn more about [image optimization](image_optimization) to deliver images with the best quality at the smallest file size.

> * Explore [image transformations](image_transformations) to discover all available options for resizing, cropping, and enhancing images.

> * Get started with the [Next.js SDK](nextjs_integration) and learn how to configure it for your project.

> * Watch more [Dev Hints videos](https://www.youtube.com/playlist?list=PL8dVGjLA2oMpaTbvoKCaRNBMQzBUIv7N8) on the [Cloudinary YouTube channel](https://www.youtube.com/cloudinary).

#### If you like this, you might also like...

[Using the Next.js Image Component](nextjs_image_component_tutorial)

Deliver images using the Next.js Image component

[Optimize Videos in Next.js](optimize_videos_nextjs_tutorial)

Optimize delivery of videos in a Next.js app

[Crop and Resize Images in React](crop_and_resize_images_in_react_tutorial)

Crop and resize images using React with Cloudinary

&nbsp;

&nbsp;Check out the Cloudinary Academy for free self-paced Cloudinary courses on a variety of developer or DAM topics, or register for formal instructor-led courses, either virtual or on-site.
&nbsp;