Resize and Crop

Uploadcare Image Transformations allow you to adjust image size and crop options on the fly, adjust resizing behavior, and set a background fill color when cropping images.



Reduces an image proportionally for it to fit into the given dimensions in pixels. If dimensions are not specified, we use the default values of 2048x2048 pixels.




Resizes an image to fit into the specified dimensions. With just a single linear dimension specified, preserves your original aspect ratio and resizes an image along one of its axes.


Change resize behavior


Sets the resize behavior when a source image is smaller than the resulting dimensions. The following modes can apply:

  • on — stretches an image up, the default option.
  • off — forbids stretching an image along any dimension that exceeds image size along any of its axes.
  • fill — does not stretch an image, the color-filled frame is rendered around instead, the default fill color is used.
Resized image but stretched
Resized image, same dimensions
Resized image, same placeholder size with a background fill

Smart resize


Content-aware resize transformation detects faces and other visually important objects or regions in an image and resizes the rest of the image so that the detected objects retain their original proportions.

Original image, 440x300





Crops an image using specified dimensions and offsets. If no offset values are passed into the operation, the top-left image corner is used by default.

Original image
Original image.
Crop to center
Crop to coordinates

If given dimensions are greater than the ones of the original image, the image is rendered inside a color-filled box. The color of that box can be changed via the setfill operation.

Scale Crop


When :type is not specified.

Scales down an image until one of its dimensions gets equal to some of the specified ones; the rest is cropped. This proves useful when your want to fit as much of your image as possible into a box. Let us compare the two resizing methods:

Resize image to a size, stretched
Requested size.
Adjust size, keep dimensions
Adjusted size.
No distortion.
Resize image to a placeholder, zoom and crop
Requested size.
No distortion.
  • :offsetsstring, format: M%,N%, where M and N are the optional offsets along one or both of the axes in percentages; other possible values include:
  • center, a keyword responsible for centering the crop focus.

Smart Crop

When smart :type is specified.

Switching the crop type to one of the smart modes enables the content-aware mechanic. Uploadcare applies AI-based algorithms to detect faces and other visually important objects or regions in images and crops the rest.


Smart crop to an object
Smart cropping.

Content-aware mechanics of the smart crop are based on the following methods of image analysis:

  • Face Detection, :type is set to smart_faces. Face detection identifies and locates human faces in digital images.
  • Object Detection, :type is set to smart_object. Object detection identifies and locates most visually important regions in the image.
  • Corner Points Detection, :type is set to smart_points. This method analyses image pixels to find the high contrast corners in the image, useful for abstract, landscape, and art images. The corner points have much less semantic information than other methods and designed to be used as a fallback.

The methods you include separating by underscore are applied sequentially. The algorithm switches to the next method only if no regions were found by the previous one. For example smart_faces_objects_points applies face detection initially as the first step. Only when no faces are found on an image, the object detection will be used. Finally, when no objects are found, the corner points will be detected.

If specified methods were unable to find regions or points of interest, the :offset setting will be used to crop an image. When no :offsets are specified, images get center-cropped.

Cropped image, auto centered on a face
Centering on faces or objects
when no faces found.
Cropped image, auto centered on objects and faces
Centering on objects or faces
when no objects found.
Image centering on hard edges
Centering on corner points.

Possible :type values:

smart (alias for smart_faces_objects_points), smart_faces_objects, smart_faces_points, smart_objects_faces_points, smart_objects_faces, smart_objects_points, smart_points, smart_objects, smart_faces.

Set fill color


Sets the fill color used with crop, stretch or when converting an alpha channel enabled image to JPEG. The operation uses hexadecimal notation to define colors.

Image, cropped to center, resized on a white background
Image, cropped to center, resized with a color filled background
PNG image with alpha channel converted to JPEG with a background fill