Resize image while keeping aspect ratio in Java

后端 未结 7 872
清歌不尽
清歌不尽 2020-12-13 10:58

im trying to resize bufferdImage in memory in java but to keep the aspect ratio of the image im have something like this but this is not good

int w = pictu         


        
7条回答
  •  挽巷
    挽巷 (楼主)
    2020-12-13 11:30

    You may have a look at perils-of-image-getscaledinstance.html that explains why getScaledInstance(), used in some of the answers, should be avoided.

    The article also provides alternative code.

提交回复
热议问题