"safe to update separate regions of a bufferedimage in separate threads?" Code Answer


have you looked into using jai to manage your 'subimages' as tiles? it seems like a better use of resources if you don't have to hang onto the original image bufferedimage instance as well as all its subimage bufferedimage instance. information about jai can be found here: jai readme

there is a class, tiledimage, which implements the renderedimage interface (giving it a common ancestor with bufferedimage). according to the jai documentation:

the use of tiling also facilitates the use of multiple threads for computation. previously allocated tiles may also be re-used to save memory.

using one of these implementations of renderedimage is often preferrable to a bufferedimage anyway, since the bufferedimage maintains an image snapshot in memory for the entire image. jai uses a rendering chain and can recycle tiles as needed to fit memory constraints.

By Sigve Karolius on July 10 2022

Answers related to “safe to update separate regions of a bufferedimage in separate threads?”

Only authorized users can answer the Search term. Please sign in first, or register a free account.