Fit Mode
This parameter enables you to fit the given image properly within the specified height and width. You need to provide values for the height, width and fit parameters. The available values for the fit parameter are bounds, cover and crop.
Fit to bounds
https://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&width={width_value}&height={height_value}&fit={fit_value}Note Check out the limitations that are applicable here.
If fit is set to bounds, it will constrain the given image into the specified height and width.
Fit to cover
https://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&width={width_value}&height={height_value}&fit={fit_value}NoteThe fit parameter requires both the height and the width parameters.
If fit is set to cover, it resizes the image (shrinks or enlarges) to fill the entire area defined by the width and height parameters. If the image's aspect ratio differs from the specified dimensions, it will be cropped centrally to fit.
Fit by cropping
https://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&width={width_value}&height={height_value}&fit={fit_value}Additional Notes
- The fit parameter requires both the height and the width parameters.
Note Check out the limitations that are applicable here.
If fit is set to crop, it will crop the given image to the defined height and width.