Title: wp_shrink_dimensions
Published: April 25, 2014
Last modified: August 20, 2026

---

# wp_shrink_dimensions( int $width, int $height, int $wmax = 128, int $hmax = 96 ): array

## In this article

 * [Description](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#description)
    - [See also](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#see-also)
 * [Parameters](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#parameters)
 * [Return](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#return)
 * [Source](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#source)
 * [Related](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#related)
 * [Changelog](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#changelog)

This function has been deprecated since 3.0.0. Use [wp_constrain_dimensions()](https://developer.wordpress.org/reference/functions/wp_constrain_dimensions/)
instead.

Calculates the new dimensions for a downsampled image.

## 󠀁[Description](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#description)󠁿

### 󠀁[See also](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#see-also)󠁿

 * [wp_constrain_dimensions()](https://developer.wordpress.org/reference/functions/wp_constrain_dimensions/)

## 󠀁[Parameters](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#parameters)󠁿

 `$width`intrequired

Current width of the image

`$height`intrequired

Current height of the image

`$wmax`intoptional

Maximum wanted width

Default:`128`

`$hmax`intoptional

Maximum wanted height

Default:`96`

## 󠀁[Return](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#return)󠁿

 array Shrunk dimensions (width, height).

## 󠀁[Source](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#source)󠁿

    ```php
    function wp_shrink_dimensions( $width, $height, $wmax = 128, $hmax = 96 ) {
    	_deprecated_function( __FUNCTION__, '3.0.0', 'wp_constrain_dimensions()' );
    	return wp_constrain_dimensions( $width, $height, $wmax, $hmax );
    }
    ```

[View all references](https://developer.wordpress.org/reference/files/wp-admin/includes/deprecated.php/)
[View on Trac](https://core.trac.wordpress.org/browser/tags/7.1/src/wp-admin/includes/deprecated.php#L50)
[View on GitHub](https://github.com/WordPress/wordpress-develop/blob/7.1/src/wp-admin/includes/deprecated.php#L50-L53)

## 󠀁[Related](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#related)󠁿

| Uses | Description | 
| [wp_constrain_dimensions()](https://developer.wordpress.org/reference/functions/wp_constrain_dimensions/)`wp-includes/media.php` |

Calculates the new dimensions for a down-sampled image.

  | 
| [_deprecated_function()](https://developer.wordpress.org/reference/functions/_deprecated_function/)`wp-includes/functions.php` |

Marks a function as deprecated and inform when it has been used.

  |

## 󠀁[Changelog](https://developer.wordpress.org/reference/functions/wp_shrink_dimensions/?output_format=md#changelog)󠁿

| Version | Description | 
| [3.0.0](https://developer.wordpress.org/reference/since/3.0.0/) | Deprecated. Use [wp_constrain_dimensions()](https://developer.wordpress.org/reference/functions/wp_constrain_dimensions/)  | 
| [2.0.0](https://developer.wordpress.org/reference/since/2.0.0/) | Introduced. |

## User Contributed Notes

You must [log in](https://login.wordpress.org/?redirect_to=https%3A%2F%2Fdeveloper.wordpress.org%2Freference%2Ffunctions%2Fwp_shrink_dimensions%2F)
before being able to contribute a note or feedback.