resize method

void resize(
  1. {int width,
  2. int height,
  3. bool disable}
)

this function lets you dynamically resize the width of the output image by specifying pixels or percentage values for more details read documentation: The disable function disables the functionality that is enabled by default. For instance, upscale is always enabled, in which the image is upscaled if the output image (by specifying the width or height) is bigger than the source image. To disable this feature, you can use the query ?disable=upscale. This ensures that even if the specified height or width is much bigger than the actual image, it will not be rendered disproportionately.

For more details, Read documentation: https://www.contentstack.com/docs/developers/apis/image-delivery-api/#resize-images

Example:

final stack = contentstack.Stack(apiKey, deliveryToken, environment);
final imageTransformation = stack.imageTransform(imageUrl);
final response =
      await imageTransformation.resize(width:100,disable:true).fetch();

Implementation

void resize({int width, int height, bool disable}) {
  if (width != null) {
    //queryParameter['width'] = width.toString();
    query.append('width', width.toString());
  }
  if (height != null) {
    query.append('height', height.toString());
  }
  if (disable != null && disable) {
    query.append('disable', 'upscale');
  }
}