Main method
1 | public static BufferedImage imageConvert(InputStream inputStream, Integer limit) throws IOException { |
Assistant method
1 | public static int getImageSize(BufferedImage img) throws IOException { |
1 | public static BufferedImage imageCompress(Image img, int w, int h) throws IOException { |
Summary
Use memory to loop picture may cause leak problem.
Use 3th part software maybe a better choice? like ffmpeg.