Class Resize

  • All Implemented Interfaces:
    CleanUpHandler, Destroyable, GlobalInfoSupporter, LoggingLevelHandler, LoggingSupporter, OptionHandler, QuickInfoSupporter, SizeOfHandler, ImageTransformer<BufferedImageContainer>, FlowContextHandler, Serializable, Comparable

    public class Resize
    extends AbstractBufferedImageTransformer
    Resizes the image to predefined width and height.
    For more information on the scaling types, see:
    https://docs.oracle.com/en/java/javase/11/docs/api/java.desktop/java/awt/Image.html

    -logging-level <OFF|SEVERE|WARNING|INFO|CONFIG|FINE|FINER|FINEST> (property: loggingLevel)
        The logging level for outputting errors and debugging output.
        default: WARNING
     
    -width <double> (property: width)
        The width to resize the image to; use -1 to use original width; use (0-1
        ) for percentage.
        default: -1.0
        minimum: -1.0
     
    -height <double> (property: height)
        The height to resize the image to; use -1 to use original height; use (0
        -1) for percentage.
        default: -1.0
        minimum: -1.0
     
    -scaling-type <DEFAULT|FAST|SMOOTH|REPLICATE|AREA_AVERAGING> (property: scalingType)
        The type of scaling to perform.
        default: DEFAULT
     
    -force-percentage <boolean> (property: forcePercentage)
        Whether to always interpret width/height as percentage (eg when upscaling
        the image).
        default: false
     
    Author:
    fracpete (fracpete at waikato dot ac dot nz)
    See Also:
    Serialized Form
    • Field Detail

      • m_Width

        protected double m_Width
        the new width.
      • m_Height

        protected double m_Height
        the new height.
      • m_ScalingType

        protected Resize.ScalingType m_ScalingType
        the type of interpolation to perform.
      • m_ForcePercentage

        protected boolean m_ForcePercentage
        whether to force percentage (eg for scaling larger).
    • Constructor Detail

      • Resize

        public Resize()
    • Method Detail

      • setWidth

        public void setWidth​(double value)
        Sets the width to resize to.
        Parameters:
        value - the width, -1 uses original width
      • getWidth

        public double getWidth()
        Returns the width to resize to.
        Returns:
        the width, -1 if original width is used
      • widthTipText

        public String widthTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setHeight

        public void setHeight​(double value)
        Sets the height to resize to.
        Parameters:
        value - the height, -1 uses original height
      • getHeight

        public double getHeight()
        Returns the height to resize to.
        Returns:
        the height, -1 if original height is used
      • heightTipText

        public String heightTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setScalingType

        public void setScalingType​(Resize.ScalingType value)
        Sets the type of interpolation to use.
        Parameters:
        value - the type
      • getScalingType

        public Resize.ScalingType getScalingType()
        Returns the type of interpolation in use.
        Returns:
        the type
      • scalingTypeTipText

        public String scalingTypeTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.
      • setForcePercentage

        public void setForcePercentage​(boolean value)
        Sets whether to always interpret the width/height as percentage (eg when upscaling the image).
        Parameters:
        value - true if to force
      • getForcePercentage

        public boolean getForcePercentage()
        Returns whether to always interpret the width/height as percentage (eg when upscaling the image).
        Returns:
        true if to force
      • forcePercentageTipText

        public String forcePercentageTipText()
        Returns the tip text for this property.
        Returns:
        tip text for this property suitable for displaying in the GUI or for listing the options.