public class ImageSubsampler extends Object
Subsamples an image to create a smaller (or larger(!)) image. This can use several sampling filters.
The algorithms and methods used in this library are based on the article "General Filtered Image Rescaling" by Dale Schumacher which appeared in the book Graphics Gems III, published by Academic Press, Inc.
Performance enhancements: (all in milliseconds)
| One | Ten | What was done? |
| 2047 | 19,812 | Initial, slow version sans opt |
| 765 | 6,719 | Using direct-access to BufferedImage's INT RBG buffer for the row sampler only |
| 406 | 3,531 | Using direct-access for the COLUMN resampler.. |
| Modifier and Type | Method and Description |
|---|---|
static void |
main(String[] args) |
static BufferedImage |
resample(BufferedImage srci,
ResamplerFilter f,
int ow,
int oh)
The actual sampler code which converts a source image to a destination
image, reducing or enlarging the image.
|
static Point |
resizeWithAspect(int w,
int h,
int iw,
int ih)
Does a resize of an object with size (iw, ih) to fit within a rectangle
of (w, h) while keeping the same aspect ratio
|
public static BufferedImage resample(BufferedImage srci, ResamplerFilter f, int ow, int oh)
public static Point resizeWithAspect(int w, int h, int iw, int ih)
public static void main(String[] args)
Copyright © 2017 etc.to. All rights reserved.