Sevlet输出图片

OutputStream out = response.getOutputStream();
image = new BufferedImage(wideth, height, BufferedImage.TYPE_INT_RGB);   
ImageIO.write(image, "jpg", out);
//图片的大小(字节)
int sum = (int) (imgSrc.getSize());
        while ((sum=sum-1024) >= 0) {
            out.write(1024);
        }
        out.write(sum);
        out.flush();
        out.close();

你可能感兴趣的:(java)