Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8099459 Optimize image loading and thumbnail creation
  3. JDK-8100250

Use subsampling to improve performance of thumbnail creation

XMLWordPrintable

    • Icon: Sub-task Sub-task
    • Resolution: Fixed
    • Icon: P3 P3
    • fx1.3
    • fx1.2
    • javafx
    • None

      We should use ImageReadParam.setSourceSubsampling() in the ImageLoader.readImageFromStream() code to improve performance of creating thumbnails from large JPEG image files. The idea is that we can use subsampling to reduce the initial cost of reading the image (and reduce memory consumption) and then use the usual multi-step downscaling algorithm for the remaining part of the process so that we still produce a high-quality thumbnail.

      For example, creating a 80x60 thumbnail from a 4000x3000 pixel image, we can use 8:8 subsampling so that Image I/O reads a 500x375 image, and then we use the multi-step algorithm to scale that down into an 80x60 thumbnail image.

      We'll need to experiment to find the right balance between speed and quality.

      Also, there is some overlap here with RT-2365... It appears that the CLibJPEGImageReader from JAI IIO Tools does not support native subsampling, so enabling can actually result in slower reading than not using it at all. If we are to pursue RT-2365, we'll need to add native subsampling support there first.

            bpb Brian Burkhalter
            campbell Christopher Campbell (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported: