Skip to main content

Resize an image

Resize transformation allows users to change the dimensions of an image. This can be done to make the image larger or smaller, to fit a certain aspect ratio, or to create different versions of the same image for different purposes.

Resize your images by setting the width and/or height parameters, using different crop parameters like a cover, fill, etc.

When resizing an image, it's important to be careful not to distort the aspect ratio or lose too much detail. Enlarging an image beyond its original size can lead to pixelation and blurriness while shrinking an image too much can result in a loss of detail and clarity. To minimize these issues, it's best to resize an image in small increments, rather than making large changes all at once.


Params

Height (h)

This parameter sets the height of the output image.

If this parameter is omitted, and the width parameter is set, the output height is set automatically such that the aspect ratio is preserved.

The maximum value for this is 10000 and any output which has more than this height will be scaled down to this value.

Width (w)

This parameter sets the width of the output image.

If this parameter is omitted, and the height parameter is set, the output width is set automatically such that the aspect ratio is preserved.

The maximum value for this is 10000 and any output which has more than this width will be scaled down to this value.

Fit (f)

Resize to fit within boundaries specified by width and height parameters.

When both a width and height are provided, the possible methods by which the image should fit these are:

  • cover: (default) Preserving aspect ratio, ensure the image covers both provided dimensions by cropping/clipping to fit.
  • contain: Preserving aspect ratio, contained within both provided dimensions using "letterboxing" where necessary.
  • fill: Ignore the aspect ratio of the input and stretch to both provided dimensions.
  • inside: Preserving the aspect ratio, resizing the image to be as large as possible while ensuring its dimensions are less than or equal to both those specified.
  • outside: Preserving the aspect ratio, resizing the image to be as small as possible while ensuring its dimensions are greater than or equal to both those specified.

Position (p)

Position the image when the original aspect ratio is different from the resultant one.

When using a fit of cover or contain, the default position is center. All the valid options are top, right_top, right, right_bottom, bottom, left_bottom, left, left_top, center.

DPR (dpr)

Device Pixel Ratio (DPR) refers to the ratio between physical pixels on a device's screen and logical pixels that are used to define the size and position of elements on a web page. In the context of blurring an image, DPR is not directly related to the blurring process itself, but it may affect how the blurred image is displayed on different devices.

The default dpr value is 1. The minimum value users can set is 0.1 and the maximum is 5. When used with selected input parameter values, the dpr value is multiplied to form the desired output. As an illustration, if the user chooses width and height as input parameters, the dpr value will be multiplied by the width and height values to get the required output. Depending on the chosen input parameters and the dpr value, different outputs will be produced.

When used with height and width values, the dpr value is multiplied to form the desired output. For instance, if the user selects (h=800, w=500, dpr=3) as input parameters, the resulting output will be 1200000 (800 x 500 x 3 = 1200000).

Background (b)

The background colour when fit is contain, defaults to black without transparency.

Uses hex value to determine the background color.

Algorithm (k)

The algorithm (kernel) to use for image reduction.

Possible interpolation kernels are:

Transform and enhance your images using our powerful AI technology. Organize your images in more efficient manner and our extensible APIs enables seamless integration with your system unleashing the power of our platform. Join the large community of users who use PixelBin to transform their image libraries and achieve excellent performance

Is this page useful?