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

Old CCITTRLE compression used instead of promissed LZW in qimagewriter (png to tiff)

    XMLWordPrintable

Details

    Description

      As title says the documentation says that LZW compression will be used if 1 (one) is provided as argument to the setCompression method of the QImageWriter, however git blame and source code are saying that not every format of the png will use LZW. This one for instance:

      f68a3dc4 (Kent Hansen           2012-01-31 07:01:22 +0100 527)             || !TIFFSetField(tiff, TIFFTAG_COMPRESSION, compression == NoCompression ? COMPRESSION_NONE : COMPRESSION_CCITTRLE)
      

      Documentation does not says explicitly which image formats can use LZW conversion that assumes each and every png image can be compressed with LZW compression method.

      As practice shows the fix should be pretty easy in this case and I see two of them:

      1. Fix documentation, specify all formats that can use LZW compression
      2. Replace this COMPRESSION_CCITTRLE with this COMPRESSION_LZW

      Which one you choose is up to you. If you prefer the first one, please assign this report to the documentation team.

      However, as practice shows replacing the old compression will work on both Linux (checked by me) and Windows (checked by support_silver).

      What here is expected:

      the implementation is synchronized with documentation and each and every png can be converted to the tiff using LZW compression.

      What actually happens:

      only some png image can be converted to the tiff using LZW compression

      Steps to reproduce:

      1. Download demo attached.
      2. Use youtube.png attached. Everything works tiff was created with LZW compression. Can be checked with tiffinfo tool
      3. Use Sample1.png. LZW is not used.

      Attachments

        1. png.zip
          0.7 kB
        2. sample1.png
          sample1.png
          22 kB
        3. youtube.png
          youtube.png
          13 kB
        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            allan.jensen Allan Sandfeld Jensen
            dmnikola Dmitry Nikolaev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes