new ResampleOp(image.getWidth() / 10, image.getHeight() / 10, ResampleOp.FILTER_QUADRATIC).filter(image, null); image = new ResampleOp(image.getWidth() / 4, image.getHeight() / 4, ResampleOp.FILTER_QUADRATIC).filter(image, null); long time = System.currentTimeMillis() - start;
/** * Creates a scaled instance of the given {@code BufferedImage}. * * @param pImage the {@code BufferedImage} to scale * @param pWidth width in pixels * @param pHeight height in pixels * @param pHints scaling mHints * * @return a {@code BufferedImage} * * @throws NullPointerException if {@code pImage} is {@code null}. * * @see Image#SCALE_AREA_AVERAGING * @see Image#SCALE_DEFAULT * @see Image#SCALE_FAST * @see Image#SCALE_REPLICATE * @see Image#SCALE_SMOOTH * @see ResampleOp */ public static BufferedImage createResampled(BufferedImage pImage, int pWidth, int pHeight, int pHints) { // Hints are converted between java.awt.Image hints and filter types return new ResampleOp(pWidth, pHeight, convertAWTHints(pHints)).filter(pImage, null); }
image = new ResampleOp(image.getWidth() / 2, image.getHeight(), ResampleOp.FILTER_LANCZOS).filter(image, null);
@Test public void testAIOOBEHeight() { BufferedImage myImage = new BufferedImage(100, 354, BufferedImage.TYPE_INT_ARGB); for (int i = 19; i > 0; i--) { ResampleOp resampler = new ResampleOp(100, i, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
@Test public void testAIOOBEWidth() { BufferedImage myImage = new BufferedImage(2832, 283, BufferedImage.TYPE_INT_ARGB); for (int i = 145; i > 143; i--) { ResampleOp resampler = new ResampleOp(i, 14, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
private void assertResample(final BufferedImage pImage, final int pWidth, final int pHeight, final int pFilterType) { BufferedImage result = new ResampleOp(pWidth, pHeight, pFilterType).filter(pImage, null); assertNotNull(result); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), pImage); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertSame(pImage, result); assertEquals(pImage.getWidth(), result.getWidth()); assertEquals(pImage.getHeight(), result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), createImage(pWidth, pHeight, pImage.getType())); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); }
ResampleOp resampleOp = new ResampleOp (100,200); BufferedImage destImage= resampleOp.filter(sourceImage, null);
ResampleOp resampleOp = new ResampleOp (100,200); BufferedImage rescaledTomato = resampleOp.filter(tomato, null);
new ResampleOp(image.getWidth() / 10, image.getHeight() / 10, ResampleOp.FILTER_QUADRATIC).filter(image, null); image = new ResampleOp(image.getWidth() / 4, image.getHeight() / 4, ResampleOp.FILTER_QUADRATIC).filter(image, null); long time = System.currentTimeMillis() - start;
new ResampleOp(image.getWidth() / 10, image.getHeight() / 10, ResampleOp.FILTER_QUADRATIC).filter(image, null); image = new ResampleOp(image.getWidth() / 4, image.getHeight() / 4, ResampleOp.FILTER_QUADRATIC).filter(image, null); long time = System.currentTimeMillis() - start;
ResampleOp resampleOp = new ResampleOp(width, height); BufferedImage scaledImage = resampleOp.filter(ImageIO.read(fileItem.getInputStream()), null);
/** * Creates a scaled instance of the given {@code BufferedImage}. * * @param pImage the {@code BufferedImage} to scale * @param pWidth width in pixels * @param pHeight height in pixels * @param pHints scaling mHints * * @return a {@code BufferedImage} * * @throws NullPointerException if {@code pImage} is {@code null}. * * @see Image#SCALE_AREA_AVERAGING * @see Image#SCALE_DEFAULT * @see Image#SCALE_FAST * @see Image#SCALE_REPLICATE * @see Image#SCALE_SMOOTH * @see ResampleOp */ public static BufferedImage createResampled(BufferedImage pImage, int pWidth, int pHeight, int pHints) { // Hints are converted between java.awt.Image hints and filter types return new ResampleOp(pWidth, pHeight, convertAWTHints(pHints)).filter(pImage, null); }
/** * Creates a scaled instance of the given {@code BufferedImage}. * * @param pImage the {@code BufferedImage} to scale * @param pWidth width in pixels * @param pHeight height in pixels * @param pHints scaling mHints * * @return a {@code BufferedImage} * * @throws NullPointerException if {@code pImage} is {@code null}. * * @see Image#SCALE_AREA_AVERAGING * @see Image#SCALE_DEFAULT * @see Image#SCALE_FAST * @see Image#SCALE_REPLICATE * @see Image#SCALE_SMOOTH * @see ResampleOp */ public static BufferedImage createResampled(BufferedImage pImage, int pWidth, int pHeight, int pHints) { // Hints are converted between java.awt.Image hints and filter types return new ResampleOp(pWidth, pHeight, convertAWTHints(pHints)).filter(pImage, null); }
@Test public void testAIOOBEHeight() { BufferedImage myImage = new BufferedImage(100, 354, BufferedImage.TYPE_INT_ARGB); for (int i = 19; i > 0; i--) { ResampleOp resampler = new ResampleOp(100, i, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
@Test public void testAIOOBEWidth() { BufferedImage myImage = new BufferedImage(2832, 283, BufferedImage.TYPE_INT_ARGB); for (int i = 145; i > 143; i--) { ResampleOp resampler = new ResampleOp(i, 14, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
@Test public void testAIOOBEHeight() { BufferedImage myImage = new BufferedImage(100, 354, BufferedImage.TYPE_INT_ARGB); for (int i = 19; i > 0; i--) { ResampleOp resampler = new ResampleOp(100, i, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
@Test public void testAIOOBEWidth() { BufferedImage myImage = new BufferedImage(2832, 283, BufferedImage.TYPE_INT_ARGB); for (int i = 145; i > 143; i--) { ResampleOp resampler = new ResampleOp(i, 14, ResampleOp.FILTER_LANCZOS); BufferedImage resizedImage = resampler.filter(myImage, null); assertNotNull(resizedImage); } }
private void assertResample(final BufferedImage pImage, final int pWidth, final int pHeight, final int pFilterType) { BufferedImage result = new ResampleOp(pWidth, pHeight, pFilterType).filter(pImage, null); assertNotNull(result); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), pImage); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertSame(pImage, result); assertEquals(pImage.getWidth(), result.getWidth()); assertEquals(pImage.getHeight(), result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), createImage(pWidth, pHeight, pImage.getType())); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); }
private void assertResample(final BufferedImage pImage, final int pWidth, final int pHeight, final int pFilterType) { BufferedImage result = new ResampleOp(pWidth, pHeight, pFilterType).filter(pImage, null); assertNotNull(result); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), pImage); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertSame(pImage, result); assertEquals(pImage.getWidth(), result.getWidth()); assertEquals(pImage.getHeight(), result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), createImage(pWidth, pHeight, pImage.getType())); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); }
private void assertResample(final BufferedImage pImage, final int pWidth, final int pHeight, final int pFilterType) { BufferedImage result = new ResampleOp(pWidth, pHeight, pFilterType).filter(pImage, null); assertNotNull(result); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), pImage); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertSame(pImage, result); assertEquals(pImage.getWidth(), result.getWidth()); assertEquals(pImage.getHeight(), result.getHeight()); result = new ResampleOp(pImage.getWidth(), pImage.getHeight(), pFilterType).filter(createImage(pWidth, pHeight), createImage(pWidth, pHeight, pImage.getType())); assertNotNull(result); assertEquals(pImage.getType(), result.getType()); assertEquals(pWidth, result.getWidth()); assertEquals(pHeight, result.getHeight()); }