Class 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.PipelineStep
    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)
    Author:
    Alex Black
    See Also:
    Serialized Form
    • 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
      ImageResizeStep inputName​(java.lang.String name)
      Set the input name - i.e., the name of the Image or List<Image> field to be processed.
      ImageResizeStep inputNames​(java.lang.String... inputNames)  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface ai.konduit.serving.pipeline.api.step.PipelineStep

        name
      • Methods inherited from interface ai.konduit.serving.pipeline.api.TextConfig

        toJson, toYaml
    • Field Detail

      • inputNames

        protected java.util.List<java.lang.String> inputNames
      • height

        protected java.lang.Integer height
      • width

        protected java.lang.Integer width
    • 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 the Image or List<Image> field to be processed. If any names have been previously set, they will be discarded when calling this method
        Parameters:
        name - Input Image or List<Image> name
        Returns:
        This instance
      • inputNames

        public ImageResizeStep inputNames​(java.lang.String... inputNames)