java image 자르기 JAVA

ImageIcon img = new ImageIcon(srcFile);

        BufferedImage bufImage = imageToBufferedImage(img.getImage(), img.getIconWidth(), img.getIconHeight());

        BufferedImage bufImage2 = bufImage.getSubimage(cX, cY, dW, dH);

        try{
            File file = new File(destFile);        // 파일의 이름을 설정한다
            FileOutputStream fos = new FileOutputStream(file);
            ByteArrayOutputStream output = new ByteArrayOutputStream();

            ImageIO.write(bufImage2,"jpg",output);
            fos.write(output.toByteArray());

        } catch(Exception e){e.printStackTrace();}


        return destFile;

공유하기 버튼

싸이월드 공감트위터페이스북
 

트랙백

이 글과 관련된 글 쓰기 (트랙백 보내기)
TrackbackURL : http://magefister.egloos.com/tb/2090480 [도움말]

덧글

댓글 입력 영역