---
title: "ImageResize"
language: "en"
type: "Symbol"
summary: "ImageResize[image, width] gives a resized version of image that is width pixels wide. ImageResize[image, {size}] gives a resized version of image with a maximum pixel width or height given by size. ImageResize[image, {width, height}] gives a resized version of image that has exactly the specified pixel width and height. ImageResize[video, ...] gives a video in which every frame is resized. ImageResize[image, {width, depth, height}] gives a resized version of a 3D image with the specified dimensions."
keywords: 
- image resize
- grow image
- enlarge image
- rescale image
- scale image
- shrink image
- image processing
- resampling
- resample
- subsampling
- upsampling
- bicubic
- seam carving
- imresize
canonical_url: "https://reference.wolfram.com/language/ref/ImageResize.html"
source: "Wolfram Language Documentation"
related_guides: 
  - 
    title: "Basic Image Manipulation"
    link: "https://reference.wolfram.com/language/guide/BasicImageManipulation.en.md"
  - 
    title: "Video Editing"
    link: "https://reference.wolfram.com/language/guide/VideoEditing.en.md"
  - 
    title: "Video Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md"
  - 
    title: "Image Processing & Analysis"
    link: "https://reference.wolfram.com/language/guide/ImageProcessing.en.md"
  - 
    title: "Geometric Operations"
    link: "https://reference.wolfram.com/language/guide/ImageGeometry.en.md"
  - 
    title: "Image Computation: Update History"
    link: "https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md"
  - 
    title: "3D Images"
    link: "https://reference.wolfram.com/language/guide/3DImages.en.md"
  - 
    title: "Computational Photography"
    link: "https://reference.wolfram.com/language/guide/ComputationalPhotography.en.md"
  - 
    title: "Video Processing"
    link: "https://reference.wolfram.com/language/guide/VideoProcessing.en.md"
related_functions: 
  - 
    title: "Thumbnail"
    link: "https://reference.wolfram.com/language/ref/Thumbnail.en.md"
  - 
    title: "ImageRotate"
    link: "https://reference.wolfram.com/language/ref/ImageRotate.en.md"
  - 
    title: "ImageCrop"
    link: "https://reference.wolfram.com/language/ref/ImageCrop.en.md"
  - 
    title: "ImageTake"
    link: "https://reference.wolfram.com/language/ref/ImageTake.en.md"
  - 
    title: "ImagePad"
    link: "https://reference.wolfram.com/language/ref/ImagePad.en.md"
  - 
    title: "ImageDimensions"
    link: "https://reference.wolfram.com/language/ref/ImageDimensions.en.md"
  - 
    title: "ImageSize"
    link: "https://reference.wolfram.com/language/ref/ImageSize.en.md"
  - 
    title: "ImagePyramid"
    link: "https://reference.wolfram.com/language/ref/ImagePyramid.en.md"
  - 
    title: "ArrayResample"
    link: "https://reference.wolfram.com/language/ref/ArrayResample.en.md"
  - 
    title: "SpatialTransformationLayer"
    link: "https://reference.wolfram.com/language/ref/SpatialTransformationLayer.en.md"
related_tutorials: 
  - 
    title: "Image Processing"
    link: "https://reference.wolfram.com/language/tutorial/ImageProcessing.en.md"
---
# ImageResize

ImageResize[image, width] gives a resized version of image that is width pixels wide.

ImageResize[image, {size}] gives a resized version of image with a maximum pixel width or height given by size.

ImageResize[image, {width, height}] gives a resized version of image that has exactly the specified pixel width and height.

ImageResize[video, …] gives a video in which every frame is resized.

ImageResize[image, {width, depth, height}] gives a resized version of a 3D image with the specified dimensions.

## Details and Options

* Image resizing changes the pixel dimensions of an image. This is needed when enlarging an image for viewing purposes or creating thumbnails when previewing a collection of images. It is also used to conform collections of images into a common size when batch processing, training, etc.

[image]

* ``ImageResize[image, w]`` and ``ImageResize[image, {s}]`` preserve the original aspect ratio of ``image``.

* Specifications for ``width``, ``height`` and ``depth`` can be any of the following:

|                            |                                   |
| -------------------------- | --------------------------------- |
| d                          | d pixels                          |
| {d}                        | maximum d pixels                  |
| Scaled[s]                  | a multiple s of the original size |
| All                        | preserve the original dimension   |
| Automatic                  | determine value from aspect ratio |
| Tiny, Small, Medium, Large | predefined absolute sizes         |

* ``ImageResize[image, w]`` is equivalent to ``ImageResize[image, {w, Automatic}]``.

* ``ImageResize[image, {size}]`` is equivalent to ``ImageResize[image, {{size}, {size}}]``.

* To obtain an image with an aspect ratio ``r``, use ``ImageResize[image, w{1, r}]``.

* The following options can be given:

|             |            |                   |
| ----------- | ---------- | ----------------- |
| Padding     | "Reversed" | padding method    |
| Resampling  | Automatic  | resampling method |

---

## Examples (20)

### Basic Examples (1)

Resize an image to be 100 pixels wide:

```wl
In[1]:= ImageResize[[image], 100]

Out[1]= [image]
```

### Scope (5)

#### Data (3)

Resize a grayscale image:

```wl
In[1]:= ImageResize[[image], 70]

Out[1]= [image]
```

---

Resize frames of a video:

```wl
In[1]:= ImageResize[Video["ExampleData/fish.mp4"], 200]

Out[1]= [image]
```

---

Resize a 3D image:

```wl
In[1]:= ImageResize[[image], 32]

Out[1]= [image]
```

#### Parameters (2)

Specify the width of the resulting image:

```wl
In[1]:=
i = [image];
ImageResize[i, 100]

Out[1]= [image]
```

Resize by a factor of $1/2$ :

```wl
In[2]:= ImageResize[i, Scaled[1 / 2]]

Out[2]= [image]
```

Use ``Automatic`` to explicitly preserve the aspect ratio of the image:

```wl
In[3]:= ImageResize[i, {Automatic, 100}]

Out[3]= [image]
```

Resize an image to have the larger dimension no greater than 200 pixels:

```wl
In[4]:= ImageResize[i, {200}]

Out[4]= [image]
```

Specify both width and height dimensions:

```wl
In[5]:= ImageResize[i, {100, 50}]

Out[5]= [image]
```

Resize in one dimension only:

```wl
In[6]:= ImageResize[i, {All, 50}]

Out[6]= [image]
```

Specify a named size:

```wl
In[7]:= ImageResize[i, Tiny]

Out[7]= [image]
```

---

Resize a 3D image:

```wl
In[1]:= i = [image];

In[2]:= ImageDimensions[i]

Out[2]= {64, 64, 50}
```

Resize given the new width:

```wl
In[3]:= ImageResize[i, 32]

Out[3]= [image]

In[4]:= ImageDimensions[%]

Out[4]= {32, 32, 25}
```

Resize given the new height:

```wl
In[5]:= ImageResize[i, {Automatic, Automatic, 32}]

Out[5]= [image]

In[6]:= ImageDimensions[%]

Out[6]= {41, 41, 32}
```

### Options (4)

#### Padding (3)

By default, ``"Reversed"`` padding is used:

```wl
In[1]:= ImageResize[[image], Scaled[2]] == ImageResize[[image], Scaled[2], Padding -> "Reversed"]

Out[1]= True
```

Use constant padding:

```wl
In[2]:= ImageResize[[image], Scaled[3], Padding -> 1]

Out[2]= [image]
```

---

When resampling method is set to ``"Nearest"``, all padding methods return the same result:

```wl
In[1]:= SameQ[ImageResize[[image], Scaled[2], Resampling -> "Nearest", Padding -> #]& /@ {1, Black, "Fixed", "Periodic", "Reflected"}]

Out[1]= True
```

---

With constant padding, the padding value is converted to the color space of the target image:

```wl
In[1]:= ImageResize[[image], {6, 6}, Resampling -> "Linear", Padding -> Red] === ImageResize[[image], {6, 6}, Resampling -> "Linear", Padding -> ColorConvert[Red, "Gray"]]

Out[1]= True
```

#### Resampling (1)

By default, ``"Lanczos"`` resampling method is used when resizing an image:

```wl
In[1]:= ImageResize[[image], Scaled[1 / 10]] == ImageResize[[image], Scaled[1 / 10], Resampling -> "Lanczos"]

Out[1]= True
```

Use method ``"Nearest"`` :

```wl
In[2]:= Image[ImageResize[[image], Scaled[1 / 10], Resampling -> "Nearest"], Magnification -> 10]

Out[2]= [image]
```

### Applications (3)

Create an image thumbnail:

```wl
In[1]:= ImageResize[[image], Small]

Out[1]= [image]
```

---

Conform and classify a list of day and night images.

Here is an example set containing labeled images of day and night:

```wl
In[1]:= examples = <|"Night" -> {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}, "Day" -> {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}|>;
```

Calculate the average dimension of the example images:

```wl
In[2]:= dims = Round@Mean[ImageDimensions /@ Flatten[Values[examples]]]

Out[2]= {128, 93}

In[3]:= conformed = Map[Image[ImageResize[#, dims], ImageSize -> 40]&, examples, {2}]

Out[3]= [image]
```

Create the classifier:

```wl
In[4]:= daynight = Classify[conformed]

Out[4]= ClassifierFunction[«1»]
```

Try this classifier on a few test images:

```wl
In[5]:= daynight[{[image], [image], [image], [image], [image], [image]}]

Out[5]= {"Day", "Day", "Day", "Night", "Night", "Night"}
```

---

Get a list of images from the web and then conform them:

```wl
In[1]:=
imgs = WebImageSearch["lion", "Images"];
Image[imgs, ImageSize -> 50]

Out[1]= [image]
```

Conform dimensions of the list of images:

```wl
In[2]:= Image[ImageResize[#, {50, 50}]& /@ imgs, ImageSize -> 50]

Out[2]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

Conform while imposing an aspect ratio that averages over the images:

```wl
In[3]:=
ars = N[#[[2]] / #[[1]]]& /@ (ImageDimensions /@ imgs);
Image[ImageResize[#, 50{1, Mean[ars]}]& /@ imgs, ImageSize -> 50]

Out[3]= {[image], [image], [image], [image], [image], [image], [image], [image], [image], [image]}
```

### Properties & Relations (4)

Resampling method ``"Nearest"`` is used when increasing the size of an image with only a few pixels:

```wl
In[1]:= [image]//ImageDimensions

Out[1]= {3, 3}

In[2]:= ImageResize[[image], Scaled[3]]

Out[2]= [image]
```

Use ``"Linear"`` resampling:

```wl
In[3]:= ImageResize[[image], Scaled[3], Resampling -> "Linear"]

Out[3]= [image]
```

---

Use ``ImageResize`` instead of ``Size`` argument in ``ImageTransformation`` :

```wl
In[1]:=
i = [image]; 
ImageTransformation[i, RotationTransform[10°], 100] == 
ImageResize[ImageTransformation[i, RotationTransform[10 °]], 100, Resampling -> "Linear"]

Out[1]= True
```

---

``Thumbnail`` is equivalent to ``ImageResize`` using size specification ``Small`` and ``"Fixed"`` padding:

```wl
In[1]:=
i = [image];
Thumbnail[i] == ImageResize[i, Small, Padding -> "Fixed"]

Out[1]= True
```

---

Importing an image with given ``ImageSize`` is equivalent to resizing after ``Import`` :

```wl
In[1]:= Import["ExampleData/rose.gif", ImageSize -> Medium] == ImageResize[Import["ExampleData/rose.gif"], Medium]

Out[1]= True
```

### Possible Issues (2)

Downsizing with no interpolation will give poor results for thin objects:

```wl
In[1]:=
i = [image];
ImageResize[i, 80, Resampling -> "Nearest"]

Out[1]= [image]
```

Use first-order interpolation:

```wl
In[2]:= ImageResize[i, 80, Resampling -> "Linear"]

Out[2]= [image]
```

---

Reducing the size of an image with high-frequency content may result in a moire pattern:

```wl
In[1]:= i = [image];

In[2]:= ImageResize[i, Scaled[0.5], Resampling -> "Linear"]

Out[2]= [image]
```

Blur the image to reduce the moire effect:

```wl
In[3]:= ImageResize[MeanFilter[i, 1], Scaled[0.5], Resampling -> "Linear"]

Out[3]= [image]
```

### Interactive Examples (1)

Create a pan and zoom application while fixing the displayed image size:

```wl
In[1]:=
image = ExampleData[{"TestImage", "Volubilis"}];
Manipulate[ImageResize[ImageTrim[image, pt, radius, Padding -> Gray], 300], {{pt, ImageDimensions[image] / 2}, {1, 1}, ImageDimensions[image]}, {{radius, 200}, 50, 400}]

Out[1]= [image]
```

## See Also

* [`Thumbnail`](https://reference.wolfram.com/language/ref/Thumbnail.en.md)
* [`ImageRotate`](https://reference.wolfram.com/language/ref/ImageRotate.en.md)
* [`ImageCrop`](https://reference.wolfram.com/language/ref/ImageCrop.en.md)
* [`ImageTake`](https://reference.wolfram.com/language/ref/ImageTake.en.md)
* [`ImagePad`](https://reference.wolfram.com/language/ref/ImagePad.en.md)
* [`ImageDimensions`](https://reference.wolfram.com/language/ref/ImageDimensions.en.md)
* [`ImageSize`](https://reference.wolfram.com/language/ref/ImageSize.en.md)
* [`ImagePyramid`](https://reference.wolfram.com/language/ref/ImagePyramid.en.md)
* [`ArrayResample`](https://reference.wolfram.com/language/ref/ArrayResample.en.md)
* [`SpatialTransformationLayer`](https://reference.wolfram.com/language/ref/SpatialTransformationLayer.en.md)

## Tech Notes

* [Image Processing](https://reference.wolfram.com/language/tutorial/ImageProcessing.en.md)

## Related Guides

* [Basic Image Manipulation](https://reference.wolfram.com/language/guide/BasicImageManipulation.en.md)
* [Video Editing](https://reference.wolfram.com/language/guide/VideoEditing.en.md)
* [Video Computation: Update History](https://reference.wolfram.com/language/guide/VideoComputation-UpdateHistory.en.md)
* [Image Processing & Analysis](https://reference.wolfram.com/language/guide/ImageProcessing.en.md)
* [Geometric Operations](https://reference.wolfram.com/language/guide/ImageGeometry.en.md)
* [Image Computation: Update History](https://reference.wolfram.com/language/guide/ImageComputation-UpdateHistory.en.md)
* [3D Images](https://reference.wolfram.com/language/guide/3DImages.en.md)
* [Computational Photography](https://reference.wolfram.com/language/guide/ComputationalPhotography.en.md)
* [Video Processing](https://reference.wolfram.com/language/guide/VideoProcessing.en.md)

## History

* [Introduced in 2008 (7.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn70.en.md) \| [Updated in 2014 (10.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn100.en.md) ▪ [2021 (13.0)](https://reference.wolfram.com/language/guide/SummaryOfNewFeaturesIn130.en.md)