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

Wrong PNG image quality calculation

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Neutral Neutral
    • 3.5.5, 4.0.0
    • 3.5.3
    • image operations
    • None

      Steps to reproduce

      1.  Follow steps in below link to create the image operation: https://docs.magnolia-cms.com/product-docs/6.2/Developing/Templating/Theme.html#_image_variations
      2.  Upload original JPG image
      3. Set output format as PNG
      4. Set output format > quality as 20

      .. Logs, screenshots, gifs...

      Expected results

      .. Justify non-trivial expectations with a link to a doc or a relevant discussion.

      Actual results

      • No very different images were generated if we set values in range 0-100

      Workaround

      • PNG currently being a special case due to our calculation, image quality floating around 5 to 9 according to its compression level. This also depends on our PNG library in used.

      Development notes

      • Compression level being set in info.magnolia.imaging.DefaultImageStreamer.writePngWithCompression(BufferedImage, OutputStream, OutputFormat)
                PngWriter pngw = new PngWriter(os, imi);
                int quality = outputFormat.getQuality();
                pngw.setCompLevel(Math.max(9 - quality, 5));
        

      The calculation shown that just in very narrow range PNG image quality could be in used.

        Acceptance criteria

              mstrucka Marek Strucka
              viet.nguyen Viet Nguyen
              DeveloperX
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

                Created:
                Updated:
                Resolved:

                  Bug DoR
                  Task DoD

                    Estimated:
                    Original Estimate - Not Specified
                    Not Specified
                    Remaining:
                    Remaining Estimate - Not Specified
                    Not Specified
                    Logged:
                    Time Spent - 0.25d
                    0.25d