简体   繁体   中英

Java Advanced Imaging Scaling Image

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

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.

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM