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
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.
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.
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.
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.
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
: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:
Nare 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.
: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.
Content-aware mechanics of the smart crop are based on the following methods of image analysis:
- Face Detection,
:typeis set to
smart_faces. Face detection identifies and locates human faces in digital images.
- Object Detection,
:typeis set to
smart_object. Object detection identifies and locates most visually important regions in the image.
- Corner Points Detection,
:typeis 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.
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.
Centering on faces or objects
when no faces found.
Centering on objects or faces
when no objects found.
Centering on corner points.
smart (alias for