Skip to content

Instantly share code, notes, and snippets.

@jalispran
Created June 30, 2019 02:40
Show Gist options
  • Save jalispran/21cd9ee99440aa6d1f3b2ba5cb15acda to your computer and use it in GitHub Desktop.
Save jalispran/21cd9ee99440aa6d1f3b2ba5cb15acda to your computer and use it in GitHub Desktop.
private BufferedImage getOverly(String logo) throws IOException {
ClassPathResource resource = new ClassPathResource(logo);
BufferedImage bufferedImage = ImageIO.read(resource.getInputStream());
int width = bufferedImage.getWidth();
int height = bufferedImage.getHeight();
int newWidth = WIDTH/6;
int newHeight = HEIGHT/6;
BufferedImage dimg = new BufferedImage(newWidth, newHeight, bufferedImage.getType());
Graphics2D g = dimg.createGraphics();
g.setRenderingHint(RenderingHints.KEY_INTERPOLATION, RenderingHints.VALUE_INTERPOLATION_BILINEAR);
g.drawImage(bufferedImage, 0, 0, newWidth, newHeight, 0, 0, width, height, null);
g.dispose();
return dimg;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment