public abstract class Thumbnail extends Object
Here "format thumbnails" refers to adding small tasteful decorations to a scaled image to make a professional looking graphic. This class uses the Scaling class to implement the actual scaling. (If all you're interested in in scaling a large image, then please refer to that class, at the accompanying discussion.)
| Modifier and Type | Class and Description |
|---|---|
protected static class |
Thumbnail
An image source that can scale to a specific size.
|
| Modifier and Type | Field and Description |
|---|---|
static Thumbnail |
Plain
A thumbnail format with no decorations.
|
protected static RenderingHints |
qualityHints
A set of high-quality rendering hints for the keys ANTIALIASING, INTERPOLATION, COLOR_RENDER, STROKE, and RENDER.
|
| Constructor and Description |
|---|
Thumbnail()
|
| Modifier and Type | Method and Description |
|---|---|
BufferedImage |
create(BufferedImage
Create a thumbnail from a BufferedImage.
|
BufferedImage |
create(File
Create a thumbnail from a file.
|
BufferedImage |
create(Image
Create a thumbnail from an image.
|
protected abstract BufferedImage |
create(Thumbnail
Create a thumbnail from an
ImageSource.
|
BufferedImage |
create(URL
Create a thumbnail from a URL.
|
public static ThumbnailPlain
protected static final RenderingHintsqualityHints
public BufferedImagecreate(URL source, Dimension maxSize)
source - a url for a PNG, JPG, GIF, or BMP image.
maxSize - the maximum dimensions of the thumbnail. Note the returned thumbnail may be smaller than these bounds. For example: if you have a 4:3 landscape-oriented picture and the maximum size is 64x64 pixels, then the return image will be 64 pixels wide and approximately 48 pixels tall. (It may not be exactly 48 pixels tall, depending on the decorations this thumbnail format may add.)
If the source image is already smaller than the maxSize, then the source image is not scaled to create this thumbnail.
public BufferedImagecreate(Image source, Dimension maxSize)
source - an image to create a thumbnail for.
maxSize - the maximum dimensions of the thumbnail. Note the returned thumbnail may be smaller than these bounds. For example: if you have a 4:3 landscape-oriented picture and the maximum size is 64x64 pixels, then the return image will be 64 pixels wide and approximately 48 pixels tall. (It may not be exactly 48 pixels tall, depending on the decorations this thumbnail format may add.)
If the source image is already smaller than the maxSize, then the source image is not scaled to create this thumbnail.
public BufferedImagecreate(File source, Dimension maxSize)
source - a file for a PNG, JPG, GIF, or BMP image.
maxSize - the maximum dimensions of the thumbnail. Note the returned thumbnail may be smaller than these bounds. For example: if you have a 4:3 landscape-oriented picture and the maximum size is 64x64 pixels, then the return image will be 64 pixels wide and approximately 48 pixels tall. (It may not be exactly 48 pixels tall, depending on the decorations this thumbnail format may add.)
If the source image is already smaller than the maxSize, then the source image is not scaled to create this thumbnail.
public BufferedImagecreate(BufferedImage source, Dimension maxSize)
source - an image to create a thumbnail for.
maxSize - the maximum dimensions of the thumbnail. Note the returned thumbnail may be smaller than these bounds. For example: if you have a 4:3 landscape-oriented picture and the maximum size is 64x64 pixels, then the return image will be 64 pixels wide and approximately 48 pixels tall. (It may not be exactly 48 pixels tall, depending on the decorations this thumbnail format may add.)
If the source image is already smaller than the maxSize, then the source image is not scaled to create this thumbnail.
protected abstract BufferedImagecreate(Thumbnail .ImageSource source, Dimension maxSize)
ImageSource.
source - the image source.
maxSize - the maximum dimensions of the thumbnail. Note the returned thumbnail may be smaller than these bounds. For example: if you have a 4:3 landscape-oriented picture and the maximum size is 64x64 pixels, then the return image will be 64 pixels wide and approximately 48 pixels tall. (It may not be exactly 48 pixels tall, depending on the decorations this thumbnail format may add.)
If the source image is already smaller than the maxSize, then the source image is not scaled to create this thumbnail.