Resize an image - scaling up or down as needed to comply with the specified output height/width.
Usually, both
height and
width are specified. However, if only one is specified, the other value is
calculated based on the aspect ration of the input image.
When both
height and
width are specified, and the aspect ratios of the input doesn't match
the aspect ratio of the output, (for example, 100x200 in, 200x200 out) the
aspectRatioHandling setting (see
AspectRatioHandling) is used to determine how to handle this situation.
Note that the names of the inputs Data fields to resize may or may not be specified:
If no value is provided for
inputNames configuration: All input
Image and
List<Image> fields
in the input Data instance will be resized, regardless of name.
If
inputNames is specified: Only those fields with those names will be resized.
Example 1: Scaling to 300x300, center cropping if needed:
new ImageResizeStep().height(300).width(300).aspectRatioHandling(AspectRatioHandling.CENTER_CROP)
Example 2: Scaling to height of 256 (any output width, maintaining original aspect ratio):
new ImageResizeStep().height(256)