|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectnet.coobird.thumbnailator.ThumbnailParameter
public class ThumbnailParameter
This class is used to specify the parameters to use when creating a thumbnail.
An instance of ThumbnailParameter
is mutable -- it should not be
reused for multiple resizes, as the parameters can change behind the scenes
as the resizing process progresses.
Field Summary | |
---|---|
static String |
DEFAULT_FORMAT_TYPE
A constant used to denote that the output format type of the thumbnail should be the default type of the codec being used. |
static int |
DEFAULT_IMAGE_TYPE
A constant used to denote that the default image type should be used when creating the thumbnail. |
static float |
DEFAULT_QUALITY
A constant used to denote that the default compression quality settings should be used when creating the thumbnail. |
static String |
DETERMINE_FORMAT
A constant used to denote that the output format of the thumbnail should be the determined from available information such as the file name of the thumbnail. |
static String |
ORIGINAL_FORMAT
A constant used to denote that the output format of the thumbnail should be the same as the format of the original image. |
static int |
ORIGINAL_IMAGE_TYPE
A constant used to denote that the image type of the original image should be used when creating the thumbnail. |
Constructor Summary | |
---|---|
ThumbnailParameter(Dimension thumbnailSize,
Region sourceRegion,
boolean keepAspectRatio,
String outputFormat,
String outputFormatType,
float outputQuality,
int imageType,
List<ImageFilter> filters,
Resizer resizer,
boolean fitWithinDimensions,
boolean useExifOrientation)
Creates an object holding the parameters needed in order to make a thumbnail. |
|
ThumbnailParameter(Dimension thumbnailSize,
Region sourceRegion,
boolean keepAspectRatio,
String outputFormat,
String outputFormatType,
float outputQuality,
int imageType,
List<ImageFilter> filters,
ResizerFactory resizerFactory,
boolean fitWithinDimensions,
boolean useExifOrientation)
Creates an object holding the parameters needed in order to make a thumbnail. |
|
ThumbnailParameter(double widthScalingFactor,
double heightScalingFactor,
Region sourceRegion,
boolean keepAspectRatio,
String outputFormat,
String outputFormatType,
float outputQuality,
int imageType,
List<ImageFilter> filters,
Resizer resizer,
boolean fitWithinDimensions,
boolean useExifOrientation)
Creates an object holding the parameters needed in order to make a thumbnail. |
|
ThumbnailParameter(double widthScalingFactor,
double heightScalingFactor,
Region sourceRegion,
boolean keepAspectRatio,
String outputFormat,
String outputFormatType,
float outputQuality,
int imageType,
List<ImageFilter> filters,
ResizerFactory resizerFactory,
boolean fitWithinDimensions,
boolean useExifOrientation)
Creates an object holding the parameters needed in order to make a thumbnail. |
Method Summary | |
---|---|
boolean |
fitWithinDimenions()
Returns whether or not to fit the thumbnail within the specified dimensions. |
double |
getHeightScalingFactor()
Returns the scaling factor to apply to the height when creating the thumbnail. |
List<ImageFilter> |
getImageFilters()
Returns the list of ImageFilter s which are applied to the
thumbnail. |
String |
getOutputFormat()
Returns the output format for the thumbnail. |
String |
getOutputFormatType()
Returns the output format type for the thumbnail. |
float |
getOutputQuality()
Returns the compression quality settings for the thumbnail. |
Resizer |
getResizer()
Returns the default Resizer that will be used when performing the
resizing operation to create a thumbnail. |
ResizerFactory |
getResizerFactory()
Returns the ResizerFactory for obtaining a Resizer which
is to be used when performing the resizing operation to create a
thumbnail. |
Dimension |
getSize()
Returns the size of the thumbnail. |
Region |
getSourceRegion()
Returns the region of the source image to use when creating a thumbnail, represented by a Region object. |
int |
getType()
Returns the type of image. |
double |
getWidthScalingFactor()
Returns the scaling factor to apply to the width when creating the thumbnail. |
boolean |
isKeepAspectRatio()
Returns whether or not the thumbnail is to maintain the aspect ratio of the source image when creating the thumbnail. |
boolean |
useExifOrientation()
Returns whether or not the Exif metadata should be used to determine the orientation of the thumbnail. |
boolean |
useOriginalImageType()
Returns whether or not the original image type should be used for the thumbnail. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ORIGINAL_FORMAT
public static final String DETERMINE_FORMAT
If a suitable output format cannot be determined, then the implementation
should behave as if ORIGINAL_FORMAT
was specified.
public static final String DEFAULT_FORMAT_TYPE
public static final float DEFAULT_QUALITY
public static final int ORIGINAL_IMAGE_TYPE
public static final int DEFAULT_IMAGE_TYPE
Constructor Detail |
---|
public ThumbnailParameter(Dimension thumbnailSize, Region sourceRegion, boolean keepAspectRatio, String outputFormat, String outputFormatType, float outputQuality, int imageType, List<ImageFilter> filters, Resizer resizer, boolean fitWithinDimensions, boolean useExifOrientation)
thumbnailSize
- The size of the thumbnail to generate.sourceRegion
- The region of the source image to use when
creating a thumbnail.
A value of null
indicates that the
entire source image should be used to create
the thumbnail.keepAspectRatio
- Indicates whether or not the thumbnail should
maintain the aspect ratio of the original image.outputFormat
- A string indicating the compression format
that should be applied on the thumbnail.
A value of
ORIGINAL_FORMAT
should be provided if the same image format as
the original should be used for the thumbnail.
A value of
DETERMINE_FORMAT
should be provided if the output format of the
thumbnail should be the determined from the
information available, such as the output file
name of the thumbnail.outputFormatType
- A string indicating the compression type that
should be used when writing the thumbnail.
A value of
DEFAULT_FORMAT_TYPE
should be provided if the thumbnail should be
written using the default compression type of
the codec specified in outputFormat
.outputQuality
- A value from 0.0f
to 1.0f
which
indicates the quality setting to use for the
compression of the thumbnail. 0.0f
indicates the lowest quality, 1.0f
indicates the highest quality setting for the
compression.
DEFAULT_QUALITY
should be specified when the codec's default
compression quality settings should be used.imageType
- The BufferedImage
image type of the
thumbnail.
A value of
DEFAULT_IMAGE_TYPE
should be specified when the default image
type should be used when creating the thumbnail.filters
- The ImageFilter
s to apply to the
thumbnail.
A value of null
will be recognized as
no filters are to be applied.
The filters are applied after the original
image has been resized.resizer
- The Resizer
to use when performing the
resizing operation to create a thumbnail.fitWithinDimensions
- Whether or not to fit the thumbnail within
the specified dimensions.
If true
is specified, then the
thumbnail will be sized to fit within the
specified dimensions, if the thumbnail is
going to exceed those dimensions.
useExifOrientation
- Whether or not to use the Exif metadata to
determine the orientation of the thumbnail.
If true
is specified, then the
Exif metadata will be used to determine
the orientation of the thumbnail.
IllegalArgumentException
- If size is null
or if the
dimensions are negative, or if the
Resizer
is null.public ThumbnailParameter(double widthScalingFactor, double heightScalingFactor, Region sourceRegion, boolean keepAspectRatio, String outputFormat, String outputFormatType, float outputQuality, int imageType, List<ImageFilter> filters, Resizer resizer, boolean fitWithinDimensions, boolean useExifOrientation)
widthScalingFactor
- The scaling factor to apply to the width
when creating a thumbnail from the original
image.heightScalingFactor
- The scaling factor to apply to the height
when creating a thumbnail from the original
image.sourceRegion
- The region of the source image to use when
creating a thumbnail.
A value of null
indicates that the
entire source image should be used to create
the thumbnail.keepAspectRatio
- Indicates whether or not the thumbnail should
maintain the aspect ratio of the original image.outputFormat
- A string indicating the compression format
that should be applied on the thumbnail.
A value of
ORIGINAL_FORMAT
should be provided if the same image format as
the original should be used for the thumbnail.
A value of
DETERMINE_FORMAT
should be provided if the output format of the
thumbnail should be the determined from the
information available, such as the output file
name of the thumbnail.outputFormatType
- A string indicating the compression type that
should be used when writing the thumbnail.
A value of
DEFAULT_FORMAT_TYPE
should be provided if the thumbnail should be
written using the default compression type of
the codec specified in outputFormat
.outputQuality
- A value from 0.0f
to 1.0f
which
indicates the quality setting to use for the
compression of the thumbnail. 0.0f
indicates the lowest quality, 1.0f
indicates the highest quality setting for the
compression.
DEFAULT_QUALITY
should be specified when the codec's default
compression quality settings should be used.imageType
- The BufferedImage
image type of the
thumbnail.
A value of
DEFAULT_IMAGE_TYPE
should be specified when the default image
type should be used when creating the thumbnail.filters
- The ImageFilter
s to apply to the
thumbnail.
A value of null
will be recognized as
no filters are to be applied.
The filters are applied after the original
image has been resized.resizer
- The Resizer
to use when performing the
resizing operation to create a thumbnail.fitWithinDimensions
- Whether or not to fit the thumbnail within
the specified dimensions.
If true
is specified, then the
thumbnail will be sized to fit within the
specified dimensions, if the thumbnail is
going to exceed those dimensions.
useExifOrientation
- Whether or not to use the Exif metadata to
determine the orientation of the thumbnail.
If true
is specified, then the
Exif metadata will be used to determine
the orientation of the thumbnail.
IllegalArgumentException
- If the scaling factor is not a
rational number or is less than or
equal to 0, or if the
Resizer
is null.public ThumbnailParameter(Dimension thumbnailSize, Region sourceRegion, boolean keepAspectRatio, String outputFormat, String outputFormatType, float outputQuality, int imageType, List<ImageFilter> filters, ResizerFactory resizerFactory, boolean fitWithinDimensions, boolean useExifOrientation)
thumbnailSize
- The size of the thumbnail to generate.sourceRegion
- The region of the source image to use when
creating a thumbnail.
A value of null
indicates that the
entire source image should be used to create
the thumbnail.keepAspectRatio
- Indicates whether or not the thumbnail should
maintain the aspect ratio of the original image.outputFormat
- A string indicating the compression format
that should be applied on the thumbnail.
A value of
ORIGINAL_FORMAT
should be provided if the same image format as
the original should be used for the thumbnail.
A value of
DETERMINE_FORMAT
should be provided if the output format of the
thumbnail should be the determined from the
information available, such as the output file
name of the thumbnail.outputFormatType
- A string indicating the compression type that
should be used when writing the thumbnail.
A value of
DEFAULT_FORMAT_TYPE
should be provided if the thumbnail should be
written using the default compression type of
the codec specified in outputFormat
.outputQuality
- A value from 0.0f
to 1.0f
which
indicates the quality setting to use for the
compression of the thumbnail. 0.0f
indicates the lowest quality, 1.0f
indicates the highest quality setting for the
compression.
DEFAULT_QUALITY
should be specified when the codec's default
compression quality settings should be used.imageType
- The BufferedImage
image type of the
thumbnail.
A value of
DEFAULT_IMAGE_TYPE
should be specified when the default image
type should be used when creating the thumbnail.filters
- The ImageFilter
s to apply to the
thumbnail.
A value of null
will be recognized as
no filters are to be applied.
The filters are applied after the original
image has been resized.resizerFactory
- The ResizerFactory
for obtaining a
Resizer
that is to be used when
performing an image resizing operation.fitWithinDimensions
- Whether or not to fit the thumbnail within
the specified dimensions.
If true
is specified, then the
thumbnail will be sized to fit within the
specified dimensions, if the thumbnail is
going to exceed those dimensions.
useExifOrientation
- Whether or not to use the Exif metadata to
determine the orientation of the thumbnail.
If true
is specified, then the
Exif metadata will be used to determine
the orientation of the thumbnail.
IllegalArgumentException
- If size is null
or if the
dimensions are negative, or if the
ResizerFactory
is null.public ThumbnailParameter(double widthScalingFactor, double heightScalingFactor, Region sourceRegion, boolean keepAspectRatio, String outputFormat, String outputFormatType, float outputQuality, int imageType, List<ImageFilter> filters, ResizerFactory resizerFactory, boolean fitWithinDimensions, boolean useExifOrientation)
widthScalingFactor
- The scaling factor to apply to the width
when creating a thumbnail from the original
image.heightScalingFactor
- The scaling factor to apply to the height
when creating a thumbnail from the original
image.sourceRegion
- The region of the source image to use when
creating a thumbnail.
A value of null
indicates that the
entire source image should be used to create
the thumbnail.keepAspectRatio
- Indicates whether or not the thumbnail should
maintain the aspect ratio of the original image.outputFormat
- A string indicating the compression format
that should be applied on the thumbnail.
A value of
ORIGINAL_FORMAT
should be provided if the same image format as
the original should be used for the thumbnail.
A value of
DETERMINE_FORMAT
should be provided if the output format of the
thumbnail should be the determined from the
information available, such as the output file
name of the thumbnail.outputFormatType
- A string indicating the compression type that
should be used when writing the thumbnail.
A value of
DEFAULT_FORMAT_TYPE
should be provided if the thumbnail should be
written using the default compression type of
the codec specified in outputFormat
.outputQuality
- A value from 0.0f
to 1.0f
which
indicates the quality setting to use for the
compression of the thumbnail. 0.0f
indicates the lowest quality, 1.0f
indicates the highest quality setting for the
compression.
DEFAULT_QUALITY
should be specified when the codec's default
compression quality settings should be used.imageType
- The BufferedImage
image type of the
thumbnail.
A value of
DEFAULT_IMAGE_TYPE
should be specified when the default image
type should be used when creating the thumbnail.filters
- The ImageFilter
s to apply to the
thumbnail.
A value of null
will be recognized as
no filters are to be applied.
The filters are applied after the original
image has been resized.resizerFactory
- The ResizerFactory
for obtaining a
Resizer
that is to be used when
performing an image resizing operation.fitWithinDimensions
- Whether or not to fit the thumbnail within
the specified dimensions.
If true
is specified, then the
thumbnail will be sized to fit within the
specified dimensions, if the thumbnail is
going to exceed those dimensions.
useExifOrientation
- Whether or not to use the Exif metadata to
determine the orientation of the thumbnail.
If true
is specified, then the
Exif metadata will be used to determine
the orientation of the thumbnail.
IllegalArgumentException
- If the scaling factor is not a
rational number or is less than or
equal to 0, or if the
ResizerFactory
is null.Method Detail |
---|
public Dimension getSize()
Returns null
if the scaling factor is set rather than the
explicit thumbnail size.
public double getWidthScalingFactor()
Returns Double.NaN
if the thumbnail size is set rather than the
scaling factor.
public double getHeightScalingFactor()
Returns Double.NaN
if the thumbnail size is set rather than the
scaling factor.
public int getType()
BufferedImage
.
public boolean isKeepAspectRatio()
true
if the thumbnail is to maintain the aspect
ratio of the original image, false
otherwise.public String getOutputFormat()
If the output format is to use the same compression format as the
original image, this method will return
ORIGINAL_FORMAT
.
If the output format should be determined from the information available
such as the file name of the thumbnail, then this method will return
DETERMINE_FORMAT
.
public String getOutputFormatType()
If the default compression type of the compression format is to be used,
then this method will return
DEFAULT_FORMAT_TYPE
.
public float getOutputQuality()
The value is in the range of 0.0f
to 1.0f
,
where 0.0f
is for the lowest quality setting and 1.0f
for
the highest quality setting.
If the default compression quality is to be used, then this method will
return DEFAULT_QUALITY
.
public List<ImageFilter> getImageFilters()
ImageFilter
s which are applied to the
thumbnail.
These filters are applied after the original image has been resized.
ImageFilter
s which are applied to the thumbnail.public Resizer getResizer()
Resizer
that will be used when performing the
resizing operation to create a thumbnail.
Resizer
to use when performing a resize
operation.public ResizerFactory getResizerFactory()
ResizerFactory
for obtaining a Resizer
which
is to be used when performing the resizing operation to create a
thumbnail.
ResizerFactory
to use to obtain the
Resizer
.public boolean useOriginalImageType()
true
if the original image type should be used,
false
otherwise.public Region getSourceRegion()
Region
object.
Region
object representing the source region
to use when creating a thumbnail.
A value of null
indicates that the entire source
image should be used to create the thumbnail.
public boolean fitWithinDimenions()
true
is returned when the thumbnail should be sized
to fit within the specified dimensions, if the thumbnail
is going to exceed those dimensions.public boolean useExifOrientation()
true
is returned when the Exif metadata should be
used to decide the orientation of the thumbnail,
false
otherwise.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |