public class ImageScale extends HttpServlet {
private static final long serialVersionUID = 1L;
/**
* @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
*/
protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
BufferedImage bufImg = ImageIO.read(new File("D:\\Downloads\\test.JPG"));
JPEGImageEncoder encoder = JPEGCodec.createJPEGEncoder(response.getOutputStream());
encoder.encode(bufImg);
}
阅读(962) | 评论(0) | 转发(0) |