Class ImageResizeStep
- java.lang.Object
-
- ai.konduit.serving.data.image.step.resize.ImageResizeStep
-
- All Implemented Interfaces:
ai.konduit.serving.pipeline.api.step.PipelineStep,ai.konduit.serving.pipeline.api.TextConfig,java.io.Serializable
public class ImageResizeStep extends java.lang.Object implements ai.konduit.serving.pipeline.api.step.PipelineStepResize an image - scaling up or down as needed to comply with the specified output height/width. Usually, bothheightandwidthare specified. However, if only one is specified, the other value is calculated based on the aspect ration of the input image. When bothheightandwidthare specified, and the aspect ratios of the input doesn't match the aspect ratio of the output, (for example, 100x200 in, 200x200 out) theaspectRatioHandlingsetting (seeAspectRatioHandling) 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 forinputNamesconfiguration: All inputImageandList<Image>fields in the input Data instance will be resized, regardless of name.
IfinputNamesis 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)- Author:
- Alex Black
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description protected AspectRatioHandlingaspectRatioHandlingprotected java.lang.Integerheightprotected java.util.List<java.lang.String>inputNamesprotected java.lang.Integerwidth
-
Constructor Summary
Constructors Constructor Description ImageResizeStep(java.util.List<java.lang.String> inputNames, java.lang.Integer height, java.lang.Integer width, AspectRatioHandling aspectRatioHandling)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ImageResizeStepinputName(java.lang.String name)Set the input name - i.e., the name of theImageorList<Image>field to be processed.ImageResizeStepinputNames(java.lang.String... inputNames)
-
-
-
Field Detail
-
inputNames
protected java.util.List<java.lang.String> inputNames
-
height
protected java.lang.Integer height
-
width
protected java.lang.Integer width
-
aspectRatioHandling
protected AspectRatioHandling aspectRatioHandling
-
-
Constructor Detail
-
ImageResizeStep
public ImageResizeStep(java.util.List<java.lang.String> inputNames, java.lang.Integer height, java.lang.Integer width, AspectRatioHandling aspectRatioHandling)
-
-
Method Detail
-
inputName
public ImageResizeStep inputName(java.lang.String name)
Set the input name - i.e., the name of theImageorList<Image>field to be processed. If any names have been previously set, they will be discarded when calling this method- Parameters:
name- InputImageorList<Image>name- Returns:
- This instance
-
inputNames
public ImageResizeStep inputNames(java.lang.String... inputNames)
-
-