Java 高级成像缩放图像

发布于 2024-10-08 23:12:18 字数 279 浏览 0 评论 0原文

我有一个 RenderedImage 形式的非常大的图像(~200,000x200,000 像素)。我裁剪了它,然后使用 JAI 的 ScaleDescriptor(它返回 RenderedOp)对其进行缩放。我的最终图像只有大约 30x30,但是当我从生成的缩放图像中调用 getAsBufferedImage (我首先获得 PlanarImage)时,需要几分钟的时间来创建。我猜想有一些参考原始图像需要很长时间,但我不确定。有谁知道为什么这会花这么长时间?

谢谢, 杰夫

I have a very large image (~200,000x200,000 pixels) in the form of a RenderedImage. I cropped it and then scaled it using JAI's ScaleDescriptor (which returns a RenderedOp). My final image is only about 30x30 but when I call getAsBufferedImage (I get the PlanarImage first) from the resulting scaled image, it takes several minutes to create. I'm guessing there is some reference back to the original image which is taking such a long time, but I'm not sure. Does anyone know why this would take so long?

thanks,
Jeff

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

野侃 2024-10-15 23:12:18

使用 JAI,您正在构建渲染链;因此,当您调用 .scale 时,它​​实际上并不会在此时进行缩放,而只是将其添加到链中(因此在调试器中它将是即时的)。只有在最后当您意识到新图像中的像素时,操作才会发生。

您正在进行的缩放量看起来很大,而且可能非常昂贵。我已经好几年没有做过JAI了;你能指定缩放算法吗?当你可以做一些更简单的事情时,它可能会进行不必要的插值。

With JAI you are building a rendering chain; so when you call .scale it does not actually scale at that point but just adds that to the chain (so in the debugger it will be instant). Only at the end when you go to realize the pixels in your new image does the operation happen.

The amount of scaling you are doing seems like a lot and is may be very expensive. I have not done JAI in a few years; can you specify the scaling algorithm? It might be doing unnecessary interpolation when you can get away with something much simpler.

往事风中埋 2024-10-15 23:12:18

尝试使用 http://www.imagemagick.org/script/index.php 你会看到更好的图像质量,

try with http://www.imagemagick.org/script/index.php you will see better picture quality,

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文