Class Resize

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

    public class Resize
    extends AbstractJAITransformer
    Resizes the image to predefined width and height.

    -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
     
    -interpolation-type <NEAREST|BILINEAR|BICUBIC|BICUBIC2> (property: interpolationType)
        The type of interpolation to perform.
        default: BICUBIC
     
    -num-subsample-bits <int> (property: numSubsampleBits)
        The number of bits to use for precision when subsampling.
        default: 8
        minimum: 1
     
    -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_NumSubsampleBits

        protected int m_NumSubsampleBits
        the number of subsample bits.
      • 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.
      • setInterpolationType

        public void setInterpolationType​(Resize.InterpolationType value)
        Sets the type of interpolation to use.
        Parameters:
        value - the type
      • getInterpolationType

        public Resize.InterpolationType getInterpolationType()
        Returns the type of interpolation in use.
        Returns:
        the type
      • interpolationTypeTipText

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

        public void setNumSubsampleBits​(int value)
        Sets the precision for subsampling in bits.
        Parameters:
        value - the number of bits
      • getNumSubsampleBits

        public int getNumSubsampleBits()
        Returns the precision for subsampling in bits.
        Returns:
        the number of bits
      • numSubsampleBitsTipText

        public String numSubsampleBitsTipText()
        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.