Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-107810

QImage::Format_Grayscale16 saved as 24bpp JPG

    XMLWordPrintable

Details

    • Bug
    • Resolution: Done
    • P3: Somewhat important
    • 6.5.0 Beta1
    • 6.4.0
    • Image formats
    • None
    • Windows
    • 311e508154 (qt/qtbase/dev) 311e508154 (qt/tqtc-qtbase/dev)

    Description

      This code is expected to save 8bpp grayscale jpg image (with only Y component). But it creates 24bpp jpg image (with 3 components: Y Cb Cr). As there is no color information, Cb and Cr are excessive and make the result file size larger then it could be.

          QImage image(10, 10, QImage::Format_Grayscale16);
          image.save(QDir::currentPath() + "/test.jpg", "JPG", 95);
      

      It is similar problem with QImageWriter. Setting the subtype to "R8" doesn't make it discard Cb and Cr components.

      MediaInfo for result jpeg file:

      Image
      Format                      : JPEG
      Width                       : 2 560 pixels
      Height                      : 1 888 pixels
      Color space                 : YUV
      Chroma subsampling          : 4:2:0
      Bit depth                   : 8 bits
      Compression mode            : Lossy
      Stream size                 : 894 KiB (100%)
      

      Expected MediaInfo:

      Image
      Format                      : JPEG
      Width                       : 2 560 pixels
      Height                      : 1 888 pixels
      Color space                 : Y
      Bit depth                   : 8 bits
      Compression mode            : Lossy
      Stream size                 : 673 KiB (100%)
      

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            vgt Eirik Aavitsland
            alexey89 alexey89
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes