|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectnet.coobird.thumbnailator.makers.ThumbnailMaker
net.coobird.thumbnailator.makers.ScaledThumbnailMaker
public final class ScaledThumbnailMaker
A ThumbnailMaker which scales an image by a specified scaling factor
when producing a thumbnail.
Upon calculating the size of the thumbnail, if any of the dimensions are
0, then that dimension will be promoted to 1. This will
cause some resizing operations to not preserve the aspect ratio of the
original image.
BufferedImage img = ImageIO.read(new File("sourceImage.jpg"));
BufferedImage thumbnail = new ScaledThumbnailMaker()
.scale(0.25)
.make(img);
BufferedImage img = ImageIO.read(new File("sourceImage.jpg"));
BufferedImage thumbnail = new ScaledThumbnailMaker()
.scale(0.50, 0.75)
.make(img);
| Constructor Summary | |
|---|---|
ScaledThumbnailMaker()
Creates an instance of ScaledThumbnailMaker without the
scaling factor specified. |
|
ScaledThumbnailMaker(double factor)
Creates an instance of ScaledThumbnailMaker with the specified
scaling factor. |
|
ScaledThumbnailMaker(double widthFactor,
double heightFactor)
Creates an instance of ScaledThumbnailMaker with the specified
scaling factors for the width and height. |
|
| Method Summary | |
|---|---|
BufferedImage |
make(BufferedImage img)
Makes a thumbnail. |
ScaledThumbnailMaker |
scale(double factor)
Sets the scaling factor for the thumbnail. |
ScaledThumbnailMaker |
scale(double widthFactor,
double heightFactor)
Sets the scaling factors for the thumbnail. |
| Methods inherited from class net.coobird.thumbnailator.makers.ThumbnailMaker |
|---|
defaultImageType, defaultResizer, defaultResizerFactory, imageType, resizer, resizerFactory |
| Methods inherited from class java.lang.Object |
|---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public ScaledThumbnailMaker()
Creates an instance of ScaledThumbnailMaker without the
scaling factor specified.
To use this ScaledThumbnailMaker, one must specify the
scaling factor to use by calling the scale(double) method
before generating a thumbnail.
public ScaledThumbnailMaker(double factor)
ScaledThumbnailMaker with the specified
scaling factor.
factor - The scaling factor to apply when resizing an
image to create a thumbnail.
public ScaledThumbnailMaker(double widthFactor,
double heightFactor)
ScaledThumbnailMaker with the specified
scaling factors for the width and height.
widthFactor - The scaling factor to apply to the width when
resizing an image to create a thumbnail.heightFactor - The scaling factor to apply to the height when
resizing an image to create a thumbnail.| Method Detail |
|---|
public ScaledThumbnailMaker scale(double factor)
Sets the scaling factor for the thumbnail.
The aspect ratio of the resulting image is unaltered from the original.
factor - The scaling factor to apply when resizing an
image to create a thumbnail.
IllegalStateException - If the scaling factor has already
been previously set.
public ScaledThumbnailMaker scale(double widthFactor,
double heightFactor)
Sets the scaling factors for the thumbnail.
widthFactor - The scaling factor to apply to the width when
resizing an image to create a thumbnail.heightFactor - The scaling factor to apply to the height when
resizing an image to create a thumbnail.
IllegalStateException - If the scaling factor has already
been previously set.public BufferedImage make(BufferedImage img)
ThumbnailMaker
make in class ThumbnailMakerimg - The source image.
ThumbnailMaker.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||