用java缩小图像
我有一个程序,用户输入图片的 url,然后 java 中的程序应该缩小图片,其宽度和高度都是 135px 的倍数。 有人可以帮忙吗?
例如,这是一张 1100X1121 的图像
但我希望图像的宽度和高度同时成为 135 的倍数且小于 700px,如下所示,现在图像为 675X675,既是 135px 的倍数又小于 700px:
I have a program whereby the user will enter the url for a picture, then a program in java should zoom out the picture with a width and height which are both multiple of 135px.
Can someone help??
for e.g. this is an image 1100X1121
but i want width and the height of the image to become both multiple of 135 and less than 700px as below, now the image is 675X675 which is both a multiple of 135px and less than 700px:
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我使用 java-image-scaling-library 进行缩放,效果很好。它可以更轻松地确定新图像的宽度和/或高度。
(请注意,它通常称为“缩放”)
I am using java-image-scaling-library for scaling and it works fine. It makes it easier to determine the width and/or height of the new image.
(Note that it is most often called "scaling")
您可以尝试这个简单的 Java 库: Imgscalr
或者是您的确定新图像尺寸的问题?
You can try this simple Java library: Imgscalr
Or is your problem to determine the dimensions of new image?