Package adams.data.jai.transformer
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
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classResize.InterpolationTypeType of interpolaction.
-
Field Summary
Fields Modifier and Type Field Description protected booleanm_ForcePercentagewhether to force percentage (eg for scaling larger).protected doublem_Heightthe new height.protected Resize.InterpolationTypem_InterpolationTypethe type of interpolation to perform.protected intm_NumSubsampleBitsthe number of subsample bits.protected doublem_Widththe new width.-
Fields inherited from class adams.data.image.AbstractImageTransformer
m_FlowContext
-
Fields inherited from class adams.core.option.AbstractOptionHandler
m_OptionManager
-
Fields inherited from class adams.core.logging.LoggingObject
m_Logger, m_LoggingIsEnabled, m_LoggingLevel
-
-
Constructor Summary
Constructors Constructor Description Resize()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddefineOptions()Adds options to the internal list of options.protected BufferedImageContainer[]doTransform(BufferedImageContainer img)Performs no transformation at all, just returns the input.StringforcePercentageTipText()Returns the tip text for this property.booleangetForcePercentage()Returns whether to always interpret the width/height as percentage (eg when upscaling the image).doublegetHeight()Returns the height to resize to.Resize.InterpolationTypegetInterpolationType()Returns the type of interpolation in use.intgetNumSubsampleBits()Returns the precision for subsampling in bits.doublegetWidth()Returns the width to resize to.StringglobalInfo()Returns a string describing the object.StringheightTipText()Returns the tip text for this property.StringinterpolationTypeTipText()Returns the tip text for this property.StringnumSubsampleBitsTipText()Returns the tip text for this property.voidsetForcePercentage(boolean value)Sets whether to always interpret the width/height as percentage (eg when upscaling the image).voidsetHeight(double value)Sets the height to resize to.voidsetInterpolationType(Resize.InterpolationType value)Sets the type of interpolation to use.voidsetNumSubsampleBits(int value)Sets the precision for subsampling in bits.voidsetWidth(double value)Sets the width to resize to.StringwidthTipText()Returns the tip text for this property.-
Methods inherited from class adams.data.image.transformer.AbstractBufferedImageTransformer
forCommandLine, forName, getTransformations
-
Methods inherited from class adams.data.image.AbstractImageTransformer
checkImage, cleanUp, compareTo, destroy, equals, getFlowContext, getQuickInfo, initialize, setFlowContext, shallowCopy, shallowCopy, transform
-
Methods inherited from class adams.core.option.AbstractOptionHandler
cleanUpOptions, finishInit, getDefaultLoggingLevel, getOptionManager, loggingLevelTipText, newOptionManager, reset, setLoggingLevel, toCommandLine, toString
-
Methods inherited from class adams.core.logging.LoggingObject
configureLogger, getLogger, getLoggingLevel, initializeLogging, isLoggingEnabled, sizeOf
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface adams.core.logging.LoggingLevelHandler
getLoggingLevel
-
Methods inherited from interface adams.core.option.OptionHandler
cleanUpOptions, getOptionManager, toCommandLine
-
-
-
-
Field Detail
-
m_Width
protected double m_Width
the new width.
-
m_Height
protected double m_Height
the new height.
-
m_InterpolationType
protected Resize.InterpolationType m_InterpolationType
the type of interpolation to perform.
-
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).
-
-
Method Detail
-
globalInfo
public String globalInfo()
Returns a string describing the object.- Specified by:
globalInfoin interfaceGlobalInfoSupporter- Specified by:
globalInfoin classAbstractOptionHandler- Returns:
- a description suitable for displaying in the gui
-
defineOptions
public void defineOptions()
Adds options to the internal list of options.- Specified by:
defineOptionsin interfaceOptionHandler- Overrides:
defineOptionsin classAbstractOptionHandler
-
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.
-
doTransform
protected BufferedImageContainer[] doTransform(BufferedImageContainer img)
Performs no transformation at all, just returns the input.- Specified by:
doTransformin classAbstractImageTransformer<BufferedImageContainer>- Parameters:
img- the image to process (can be modified, since it is a copy)- Returns:
- the copy of the image
-
-