나는 javax.imageio 패키지 대신 이미지에 대한 간단한 회전, 자르기 및 크기 조정 작업을 수행 할 수있는 좋은 대안을 찾고 있습니다. 예를 들어, I는 우측으로 각도를 도 회전 높이 폭 X 화소 축소 된 이미지를 얻기 위해거기에 javax.imageio 좋은 대안이 있습니까?
int angle, height, width;
image.rotateRight(angle).scale(height, width);
을하고 싶다. Graphics2D를하고 BufferedImage의 사용
, 내가 쓰고 읽을 수 없으며, 쉽게도되는,이 작업을 수행해야합니다 :
BufferedImage result = new BufferedImage(width, height, BufferedImage.TYPE_INT_RGB);
Graphics2D graphics = result.createGraphics();
graphics.translate(height/2, width/2);
graphics.rotate(angle);
graphics.translate(-width/2, -height/2);
graphics.drawImage(image, 0, 0, width, height, null);
는 (사실,이 코드도 정사각형이 아닌 이미지를 고려하지 않는 나는 번역과 함께 더욱더 마술을해야 할 것입니다.)
감사합니다. – Jorn