使用Apache Commons Imaging进行图像缩放

huangapple go评论99阅读模式
英文:

Scaling images with Apache Commons Imaging

问题

以下是翻译的内容:

我想要一种高质量的方式来缩放图像,特别是JPEG图像,使用Java。我在2007年左右进行了广泛的研究,当时JAI存在问题,会在某些缩放图像中产生黑色边框。

那时候,我最终采用了一种技术,使用Image.getScaledInstance()并结合Graphics2D渲染提示将其写入BufferedImage,这个技术是从Perry Nguyen描述的技术进行修改的。这种方法速度较慢,但生成的图像在质量上几乎与JAI子采样平均相同,但没有不正确的边框。

在重新研究这个问题时,我进行了一些快速的调查,但我没有看到比将近15年前的方法更好的方式来做到这一点。然而,我找到了Apache Commons Imaging,这是一个声称仅使用Java的新项目,因此很有前途。不幸的是,我找不到有关缩放图像的任何文档。

Apache Common Imaging是否处理图像的高质量缩放?如果是这样,我在哪里可以找到文档?

英文:

I would like a high-quality way to scale images, in particular JPEG images, using Java. I looked into this extensively around 2007, and at the time JAI had problems that would produce black borders in some scaled images.

Back then I finally settled on a technique of using Image.getScaledInstance() and writing to a BufferedImage with Graphics2D rendering hints, modified from a technique described by Perry Nguyen. This approach was slower, but produced images virtually identical in quality to JAI subsample average, but without the incorrect borders.

In revisiting this I did some quick research, but I don't see that there is any better way to do this than there was almost 15 years ago. However I did find Apache Commons Imaging, a new project that claims to only use Java, so it promising. Unfortunately I couldn't find any documentation on scaling images.

Does Apache Common Imaging handle high-quality scaling of images? If so, where can I find documentation?

答案1

得分: 1

请查看Patrick Favre的density-converter库。

这主要是一个面向移动系统(Android、iOS)的命令行和GUI图像处理工具。

即使您正在寻找一种将其与您的代码集成的方法,请查看ImageHandler类中执行的缩放机制实现,以及包中定义的不同算法at.favre.tools.dconvert.converters.scaling,我认为这可能会有所帮助。

英文:

Please, take a look at Patrick Favre's density-converter library.

It is mainly a command line and GUI image processing tool designed for mobile (Android, iOS) systems.

But even in the case you are looking for a way to integrate it with your code, please review the scaling mechanism implementation performed in the ImageHandler class and the different algorithms defined in the package at.favre.tools.dconvert.converters.scaling, I think it could be helpful.

huangapple
  • 本文由 发表于 2020年10月26日 01:52:38
  • 转载请务必保留本文链接:https://go.coder-hub.com/64526926.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定