Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8365877

PNG version 3 spec features : HDR, EXIF, APNG (Animation)

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Unresolved
    • Icon: P4 P4
    • tbd
    • None
    • client-libs
    • None

      A "version 3" of the PNG spec was released in June 2025 https://www.w3.org/TR/png-3/

      Since the JDK supports PNG, and it has already come up a couple of times, this issue covers the new features and how they might affect JDK.


      Key new features
      - HDR
      - EXIF
      - Animation

      The "reference implementation" for PNG is libpng.
      As of July 2025 it supports all these new features

      The JDK provides 3 PNG decoders
      - a native libpng subset used only for SplashScreen before the VM is running
      - a Java PNG decoder, used by by the java.awt.Toolkit image decoder
      - a Java PNG decoder and encoder as part of javax.imageio

       JavaFX also has a decoder which uses libpng too.

      The first point to note is that the new features are not breaking changes.
      Existing PNG decoders will continue to be able to read PNG files that use v3 features.


      Let's examine the features and how important they might be for each of the JDK implementations

      HDR
      ----

      This uses several new chunks (cLLI, mDVC, cICP) to provide information for color handling all the way to the display.
      These are ancilliary chunks so ignoring them has just the effect of reduced color accuracy, and no worse than today.
      But doing this properly requires rendering all the way to the device to handle this.
      We could decode the image using the info in these chunks but not more.
      I think this can be ignored for now.

      EXIF
      ----

      This is about image metadata, such as that saved alongside JPG data by most modern cameras.
      Image I/O's JPG and TIFF plugins have some support for EXIF. libpng has also had unofficial support for a while but only now does the spec. support it.
      We could extend EXIF support in Image I/O to PNG, so that it can be observed and re-encoded.
      This would be nice to do, but not urgent.
      But it isn't relevant to viewing the image, and so the other decoders won't need updating.

      Animation
      --------

      Standardisation of "APNG".
      Looks like support for this was added into libpng (https://github.com/pnggroup/libpng/pull/706)
      shortly after the spec. was released

      Whilst the spec. requires that animated pngs provide a static image, so that old decoders would notice,
      this is the one that if widely adopted people would "notice".
      JDK handles animated GIF images, and we'd need to handle APNG in the same way.
      Image I/O would return a sequence of images.
      Toolkit decoder would need to display the animation. Splashscreen too probably.
      Since Toolkit decode and Image I/O do not use libpng, we'd need to update these to decode the frames.

      I think JavaFX since it uses libpng should be able to leverage that, just as we could with splashscreen.

      Specific things we want to implement can be linked this as an umbrella RFE.

            jdv Jayathirth D V
            prr Philip Race
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: