What is the best way to scale images in Java?

前端 未结 7 1072
时光取名叫无心
时光取名叫无心 2020-12-30 06:14

I have a web application written in Java (Spring, Hibernate/JPA, Struts2) where users can upload images and store them in the file system. I would like to scale those images

7条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-30 06:57

    Have a look at the Java Image I/O API to read/write the image. Then use AffineTransform to resize.

    Also, here's a complete example using java.awt.Image.

提交回复
热议问题