java scaleabsolute,提高在Java中使用缩放JPEG图像质量

博主在尝试生成600x400px、144dpi的JPEG图片,但只能得到72dpi的图像。于是计划先生成1200x800px、72dpi的图片,再缩放为600x400px,期望通过这种方式获得144dpi。尝试了调整元数据和使用AffineTransform的方法,但效果不佳。最后,博主通过iText库的Image.scaleAbsolute()方法解决了问题,实现了保持像素数量不变,增加dpi的同时缩小图像尺寸。
摘要由CSDN通过智能技术生成

I am generating a jpg image using phantomjs. I want image with 600x400px dimension and 144 dpi/ppi.

But I am only able to generate a image with 72dpi. So, I am trying to generate the image with 1200x800px dimensions in 72 dpi and then resizing it to 600x400px.

so my idea is,

1200x800 px has dpi 72

so,

600x400px will have dpi 72*2 = 144 (because 1200/2=600px , 800/2=400px )

I am using java. But whenever I resize my image the quality becomes less.

Approaches I tried :

I tried to manipulate the metadata information of image as explained in the post below, but still it gives image with poor quality.

I tried using AffineTransform as given in following post, still not satisfied with results:

Am I using a wrong approach? If yes, then please suggest some alternatives.

If the approach is right then please

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值