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

QImageReader:setScaledSize for jpeg puts uninitialized data in rightmost pixel column

XMLWordPrintable

      The bug is picky about image sizes. The width of the image after scaling must be divisible by 8 and it only occurs for jpegs.
      This is probably the same bug as #238083, I reported it because there is no "12 pixels" here, the entire rightmost pixel column is affected, and the demo code might be useful.

      In the following example the resulting smallwhite.png is all-white except for the rightmost pixel column which appears to be filled with uninitialized data (usually zeros so it gets black)

      example code:

      #include <QApplication>
      #include <QImage>
      #include <QImageReader>

      int main( int argc, char **argv )
      {
      QApplication app( argc, argv );

      QImage big(3264,2448, QImage::Format_RGB32);
      big.fill(0xffffffff);
      big.save("bigwhite.jpg");

      QImageReader reader("bigwhite.jpg");
      reader.setScaledSize(QSize(200,150)); // width divisible by 8
      QImage img = reader.read();
      img.save("smallwhite.png");

      return 0;
      }

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

            sletta Gunnar Sletta
            janichol Andy Nichols
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:

                There are no open Gerrit changes