List of utility methods to do BufferedImage Thumbnail
void | thumbnail(File input, File output, int sizeX, int sizeY) Create a file containing a thumbnail image from another file. if (debugLevel > 2) { System.out.println("Arguments: " + input.getCanonicalPath() + ", " + output.getCanonicalPath() + ", " + Integer.toString(sizeX) + ", " + Integer.toString(sizeY)); Integer targetX = 0; Integer targetY = 0; if (sizeX <= 0 && sizeY <= 0) { throw new IOException("Either target width or target height must be positive"); ... |
void | thumbnail(final InputStream inputStream, final int width, final int height, final OutputStream outputStream) thumbnail thumbnail(inputStream, width, height, false, outputStream); |
boolean | thumbnail(int imageWidth, int imageHeight, File originFileName, File thumbFileName) thumbnail boolean result = false; try { BufferedImage bufferOriginImg = ImageIO.read(originFileName); BufferedImage bufferThumbImg = new BufferedImage(imageWidth, imageHeight, BufferedImage.TYPE_3BYTE_BGR); Graphics2D graphic = bufferThumbImg.createGraphics(); graphic.drawImage(bufferOriginImg, 0, 0, imageWidth, imageHeight, null); ImageIO.write(bufferThumbImg, "jpg", thumbFileName); result = true; ... |