---
title: "How to resize NFT images and thumbnails with NFT API"
description: "Resize NFT images with Alchemy’s API while maintaining aspect ratios for optimal display."
---

# How to resize NFT images and thumbnails with NFT API

When working with Alchemy's NFT API, you may need to resize **images** or **thumbnails** to fit different device screens or layouts. This guide will walk you through resizing both while maintaining the correct aspect ratio.

## Resizing NFT thumbnails

Thumbnails are automatically generated and cached in the payload response for convenience. These are smaller, compressed versions of the original image optimized for quick loading.

### Example of a thumbnail URL:

```
https://res.cloudinary.com/alchemyapi/image/upload/thumbnail/eth-mainnet/<hash>
```

### How to resize thumbnails:

To resize a thumbnail, you can modify the Cloudinary URL by adding specific width \(\`w\_\`\) and height \(\`h\_\`\) values. For example, to set a width of 256 pixels while keeping the original aspect ratio, you would do the following:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_256/thumbnail/eth-mainnet/<hash>
```

This resizes the thumbnail to a width of 256 pixels while maintaining its aspect ratio. You can also define height \(\`h\_\`\) if needed.

### Customizing thumbnail size:

You can use any combination of width and height values to get the desired size:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_400,h_400/thumbnail/eth-mainnet/<hash>
```

## Resizing NFT images

Original images are the high-resolution versions of the NFTs and are also stored on Alchemy's CDN. These can be resized similarly to thumbnails but require a different approach for optimal quality.

### Example of an image URL:

```
https://nft-cdn.alchemy.com/eth-mainnet/<hash>
```

### How to resize images:

To resize the original image while keeping the aspect ratio, use Cloudinary’s width \(\`w\_\`\) and height \(\`h\_\`\) values in the URL like this:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_256/scaled/eth-mainnet/<hash>
```

This will return the image resized to a width of 256 pixels, with the aspect ratio maintained. You can adjust the width or height as needed.

### Customizing image size:

Just like with thumbnails, you can use any width and height values to resize the original image:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_400,h_400/scaled/eth-mainnet/<hash>
```

## Key differences between NFT thumbnails and images

- **Thumbnails**: Compressed, smaller versions for quick loading. Best for previews and small display areas.

- **Images**: Full-resolution, high-quality versions of the NFT asset. Best for larger screens or when displaying full details of the NFT.

### Important notes

- **Thumbnails** and **images** are resized through Cloudinary but have different URL paths, so be sure to modify the correct URL.

- Always maintain the aspect ratio by using only width \(\`w\_\`\) or height \(\`h\_\`\) unless you need to alter the ratio intentionally.

### Summary

- For **thumbnails**, modify the URL like this:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_256/thumbnail/eth-mainnet/<hash>
```

- For **images**, modify the URL like this:

```
https://res.cloudinary.com/alchemyapi/image/upload/w_256/scaled/eth-mainnet/<hash>
```

This approach ensures that you can resize both the thumbnail and the original image while maintaining the aspect ratio and optimizing for different display needs!
