Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. TIFF CMYKA image loses transparency on load/conversion to Format_ARGB32
Forum Updated to NodeBB v4.3 + New Features

TIFF CMYKA image loses transparency on load/conversion to Format_ARGB32

Scheduled Pinned Locked Moved Unsolved General and Desktop
13 Posts 4 Posters 3.4k Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi and welcome
    It could be a bug?
    https://bugreports.qt.io/browse/QTBUG-50902

    Can you test with Qt 5.7 or at least
    5.6.1?

    CrinC 1 Reply Last reply
    0
    • VRoninV Offline
      VRoninV Offline
      VRonin
      wrote on last edited by
      #3

      Qt 5.7 tested and still affected

      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
      ~Napoleon Bonaparte

      On a crusade to banish setIndexWidget() from the holy land of Qt

      CrinC 1 Reply Last reply
      2
      • VRoninV Offline
        VRoninV Offline
        VRonin
        wrote on last edited by VRonin
        #4

        when running it I get a warning on load:

        TIFFReadDirectory: Warning, Unknown field with tag 37724 (0x935c) encountered.
        

        So I tried with a .tif file I created on the fly with Gimp ( link here for 30 days) and it works perfectly.

        The problem seems to be with your test.tif rather than anything in Qt

        "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
        ~Napoleon Bonaparte

        On a crusade to banish setIndexWidget() from the holy land of Qt

        CrinC 1 Reply Last reply
        2
        • VRoninV VRonin

          Qt 5.7 tested and still affected

          CrinC Offline
          CrinC Offline
          Crin
          wrote on last edited by
          #5

          @VRonin Thank you for your update, VRonin

          1 Reply Last reply
          0
          • mrjjM mrjj

            Hi and welcome
            It could be a bug?
            https://bugreports.qt.io/browse/QTBUG-50902

            Can you test with Qt 5.7 or at least
            5.6.1?

            CrinC Offline
            CrinC Offline
            Crin
            wrote on last edited by
            #6

            @mrjj Many thanks for your input mrjj, the patch for QTBUG-50902 looked very promising but according to vronin the behaviour is the same in Qt5.7 ...

            mrjjM 1 Reply Last reply
            0
            • CrinC Crin

              @mrjj Many thanks for your input mrjj, the patch for QTBUG-50902 looked very promising but according to vronin the behaviour is the same in Qt5.7 ...

              mrjjM Offline
              mrjjM Offline
              mrjj
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @Crin

              well his TIFF did display correctly.
              I also made a trans TIFF in photoshop and it worked too.

              One diff i spotted with your test and his was CMYK vs RGB so maybe only some tiff is affected as
              its clearly possible to make it work. (just test with his tiff)

              CrinC 1 Reply Last reply
              0
              • VRoninV VRonin

                when running it I get a warning on load:

                TIFFReadDirectory: Warning, Unknown field with tag 37724 (0x935c) encountered.
                

                So I tried with a .tif file I created on the fly with Gimp ( link here for 30 days) and it works perfectly.

                The problem seems to be with your test.tif rather than anything in Qt

                CrinC Offline
                CrinC Offline
                Crin
                wrote on last edited by
                #8

                @VRonin
                Hi again VRonin,

                Thanks for trying it. Your time and help is appreciated.

                I should have said the sample TIFF was created in and saved from
                Adobe Photoshop. When I use the Generic Image Library (outside Qt),
                everything works fine, in the sense that I can load and extract the alpha channel
                and image data. And I can import and display the image in
                other applications. And stuff the image into PDF using the GIL
                to separate the streams ...

                AFAIK the warning message you saw does not indicate anything
                wrong with the TIFF file per se, it's just a quirk in the way
                the TIFF library handles legitimate but unrecognised tags. See, e.g.

                imagemagick discussion

                I don't know how Adobe uses tag 37724, but I don't think its presence
                should cause a problem. Also no problems are suggested by

                identify -verbose

                The image you posted has (from Imagemagick's identify -verbose):

                Colorspace: Gray
                Compression: None
                ICC-profile: (none)

                My posted test image has:

                Colorspace: CMYK
                Compression: LZW
                ICC-profile: Coated FOGRA27 (ISO 12647-2:2004) [557188 bytes!!!]

                Unfortunately these kinds of images from Photoshop seem to be all
                the rage these days, and if I tell people we can't handle them, they're
                not impressed.

                Thanks again

                1 Reply Last reply
                0
                • mrjjM mrjj

                  @Crin

                  well his TIFF did display correctly.
                  I also made a trans TIFF in photoshop and it worked too.

                  One diff i spotted with your test and his was CMYK vs RGB so maybe only some tiff is affected as
                  its clearly possible to make it work. (just test with his tiff)

                  CrinC Offline
                  CrinC Offline
                  Crin
                  wrote on last edited by Crin
                  #9

                  @mrjj Ah, interesting, the cmyk/rgb issue fits with what we've found. We opened and saved test.tif using gimp, it saved as an RGBA tiff and that displays fine (with transparency) in Qt. Opening it in photoshop vs 3, it displays as transparent in photoshop, (re)saving out as tiff, opting to keep transparency with LZW compression, the new image still shows as opaque in Qt...

                  1 Reply Last reply
                  1
                  • mrjjM Offline
                    mrjjM Offline
                    mrjj
                    Lifetime Qt Champion
                    wrote on last edited by
                    #10

                    well actually I also had strange experience.
                    I took his gimp image and pasted ur image over it and saved.
                    Then transparent was lost.
                    I then tried to flipflop all TIFF option in PS but i never got it to work
                    again.

                    So it seems that Qt dont like some PS Tiff images with regards of keeping the alpha.

                    1 Reply Last reply
                    0
                    • VRoninV Offline
                      VRoninV Offline
                      VRonin
                      wrote on last edited by VRonin
                      #11

                      Even Gimp, that is written in Gtk+ so nothing to do with Qt and being specialised image manipulator fails to load the transparency from your file. Photoscape, Inkscape and Microsoft Paint fail to load the image altogether.

                      I'm not rich enough to own Photoshop to test it but given 4 of the most popular image manipulator programs can't load the transparency I can't rule out the problem being only with the file.

                      Could you provide another file that presents the same issue? Was test.tif created on Mac?

                      "La mort n'est rien, mais vivre vaincu et sans gloire, c'est mourir tous les jours"
                      ~Napoleon Bonaparte

                      On a crusade to banish setIndexWidget() from the holy land of Qt

                      mrjjM 1 Reply Last reply
                      1
                      • VRoninV VRonin

                        Even Gimp, that is written in Gtk+ so nothing to do with Qt and being specialised image manipulator fails to load the transparency from your file. Photoscape, Inkscape and Microsoft Paint fail to load the image altogether.

                        I'm not rich enough to own Photoshop to test it but given 4 of the most popular image manipulator programs can't load the transparency I can't rule out the problem being only with the file.

                        Could you provide another file that presents the same issue? Was test.tif created on Mac?

                        mrjjM Offline
                        mrjjM Offline
                        mrjj
                        Lifetime Qt Champion
                        wrote on last edited by
                        #12

                        @VRonin
                        So most likely its the lib used by the tiff plugin that dont agree with PS tiff images.
                        Those other linux tools might use same lib?

                        Fun thing is that his image display fine in PS and other windows image viewers.

                        So yes, i agree, more test images would be great :)
                        and thx for helping testing!

                        concreteRickC 1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @VRonin
                          So most likely its the lib used by the tiff plugin that dont agree with PS tiff images.
                          Those other linux tools might use same lib?

                          Fun thing is that his image display fine in PS and other windows image viewers.

                          So yes, i agree, more test images would be great :)
                          and thx for helping testing!

                          concreteRickC Offline
                          concreteRickC Offline
                          concreteRick
                          wrote on last edited by
                          #13

                          @mrjj

                          Those other linux tools might use same lib?

                          I think that's likely a very good point--tho' not limited to
                          Linux tools. Even some Adobe products have problems reading some
                          Photoshop TIFF files (e.g. FrameMaker and maybe Fireworks).

                          Here is some background that may be relevant and helpful. This is
                          partially from memory, rather than based on solid evidence. So
                          corrections are very welcome.

                          The TIFF standard was initially developed and published by Aldus
                          and then Adobe. It may now be an ISO standard, ISO 12639:2004. See:

                          http://www.iso.org/iso/home/store/catalogue_ics/catalogue_detail_ics.htm?csnumber=34342

                          In the late 1980's early 1990's Sam Leffler of BSD and other fame
                          developed the brilliant libTIFF library in C and made the source code
                          freely available for any use whatsoever. Following that, a handy set
                          of 'TIFF Tools' was released, using libTiff. TIFF Tools was much used
                          on Unix systems, esp Sun and SGI machines. Development of libTIFF
                          was continued by a new group. See:

                          http://www.remotesensing.org/libtiff/

                          I'm fairly sure that versions of the libTIFF libraries are used in
                          many applications, on Windows, Mac, in open source and in closed source.

                          In 2002 Adobe Systems published a document called "Adobe Photoshop
                          TIFF Technical Notes", which explains the special use of tag number 37724.
                          See:

                          http://partners.adobe.com/public/developer/en/tiff/TIFFphotoshop.pdf

                          AFAIK the TIFF standard allows Adobe, and anyone else, to define
                          special TIFF tags. So the warning issued by some libraries that tag
                          37724 is 'unknown' might indicate one of the following:

                          • The library was developed before 2002
                          • The developers were unaware of the above Adobe document
                          • The developers did not have time for or interest in supporting
                            several variants of TIFF files saved from Photoshop

                          In, or before 2006, Adobe open-sourced it's C++ Generic Image Library (GIL)
                          The GIL is now incorporated into Boost. See:

                          https://sourceforge.net/adobe/genimglib/home/Home/

                          Coming back to the original post, and follow ups, as I read them,
                          s/he is saying:

                          • GIL seems to be able to handle Photoshop TIFF of the example type
                            supplied (test.tif, i.e. containing tag 37724 and transparency).
                            S/he has tried it, and used it to extract various color, alpha
                            and ICC profile streams, put them into the appropriate PDF dictionaries,
                            and the resulting PDF file shows the transparency correctly on-screen.

                          • QImage::load(test.tif) does not handle it correctly (transparency
                            is lost) [There is no 'fault' in the test.tif file--it's just a PS
                            TIFF file using the documented 37724 tag that includes 8BIM
                            profile, inter alia.]

                          And then s/he is asking if anyone has any suggestions about how, e.g.
                          GIL may be used to overcome this issue with QImage::load() as a, maybe
                          very complicated, workaround: viz.

                          Using GIL we are able to split the uncompressed alpha and CMYK channel
                          data out from the CMYK into std::vector<unsigned char> variables, but
                          I have no idea how to map/convert this into a QImage structure which
                          displays correctly ...?

                          So "how to map/convert this into a QImage structure which displays
                          correctly" is the real question.

                          The problem, I guess, is that a huge number of professionals use Photoshop
                          and s/he needs to keep them happy.

                          If s/he finds a workaround to this issue, it could be a help to many
                          Qt users.

                          /Rick

                          PS. This:

                          https://bugs.scribus.net/print_bug_page.php?bug_id=2971

                          might imply that Scribus has overcome this issue. But I'm not sure.

                          1 Reply Last reply
                          2

                          • Login

                          • Login or register to search.
                          • First post
                            Last post
                          0
                          • Categories
                          • Recent
                          • Tags
                          • Popular
                          • Users
                          • Groups
                          • Search
                          • Get Qt Extensions
                          • Unsolved