Uploaded image for project: 'Imaging'
  1. Imaging
  2. MGNLIMG-353

ImageUtil reports useless flattenTransparentImageForOpaqueFormat warning

XMLWordPrintable

    • Icon: Improvement Improvement
    • Resolution: Unresolved
    • Icon: Neutral Neutral
    • None
    • 3.5.10
    • None
    • None
    • Yes
    • Yes

      It's pretty common to find this warning in the log file. The demo site often has these warnings reported. The problem here is the warning is basically useless since there isn't anyway for me to track down which image is creating the issue. The warning generically tells me I should "Consider replacing image" but what image? What is it's path or uuid?

      WARN  info.magnolia.imaging.util.ImageUtil 26.02.2024 12:05:43 -- flattenTransparentImageForOpaqueFormat cannot run on image with ComponentColorModel. Consider replacing image. Falling back to slower fillTransparantPixels method to flatten image. [img:BufferedImage@44f9f1da: type = 0 ColorModel: #pixelBits = 32 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@439d039d transparency = 3 has alpha = true isAlphaPre = false ByteInterleavedRaster: width = 160 height = 160 #numDataElements 4 dataOff[0] = 0]
      

      Reproduce
      In the Assets app, open /travel-demo/social-icons and these are written to the console (6 warnings, by the img:BufferedImage@<hex> correlating probably with each of the 6 PNG files in that folder).

      Notes/Discovery
      While debugging the issue I can see flattenTransparentImageForOpaqueFormat is being called by DefaultImageStreamer which gets passed params. These params have the node to be flattened. Therefore we should add a new flattenTransparentImageForOpaqueFormat method which can take in the path of the node so that it can be reported in the cases where the method cannot run correctly. See proposed patch.

      2024-02-28 09:28:44,133 WARN  info.magnolia.imaging.util.ImageUtil : flattenTransparentImageForOpaqueFormat cannot run on image with ComponentColorModel. Consider replacing image [/social-icons/linkedin.png/jcr:content]. Falling back to slower fillTransparantPixels method to flatten image. [img:BufferedImage@45767b52: type = 0 ColorModel: #pixelBits = 32 numComponents = 4 color space = java.awt.color.ICC_ColorSpace@2e3873dc transparency = 3 has alpha = true isAlphaPre = false ByteInterleavedRaster: width = 160 height = 160 #numDataElements 4 dataOff[0] = 0]
      

        Acceptance criteria

              Unassigned Unassigned
              rgange Richard Gange
              Foundation
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0d
                  0d
                  Logged:
                  Time Spent - 3h
                  3h