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. Image plugin
QtWS25 Last Chance

Image plugin

Scheduled Pinned Locked Moved Solved General and Desktop
21 Posts 5 Posters 8.2k Views
  • 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.
  • S Offline
    S Offline
    samdol
    wrote on last edited by
    #1

    Hello, Qt support basic image formats such as jpg, gif, png, ...
    I need to support more image formats in my application.
    Here is the site I found how to do it.
    https://doc.qt.io/archives/qq/qq17-imageio.html
    But I need to build my application statically and as far as I know if I build statically, I cannot use plugin.
    Then how can I support more image formats if I compile statically?

    1 Reply Last reply
    0
    • L Offline
      L Offline
      LuGRU
      wrote on last edited by
      #2

      Hello,
      By that logic static version of Qt won't support jpeg / gif etc.
      Yes it's possible and supported, please do see doc: http://doc.qt.io/qt-5/plugins-howto.html#static-plugins

      S 1 Reply Last reply
      2
      • A Offline
        A Offline
        ambershark
        wrote on last edited by
        #3

        @samdol Also make sure you're aware of the licensing issues if you build statically. If you are not using the commercial license distributing a static binary would put you in violation of the license agreement and could get you in some serious financial trouble. ;)

        My L-GPL'd C++ Logger github.com/ambershark-mike/sharklog

        1 Reply Last reply
        2
        • L LuGRU

          Hello,
          By that logic static version of Qt won't support jpeg / gif etc.
          Yes it's possible and supported, please do see doc: http://doc.qt.io/qt-5/plugins-howto.html#static-plugins

          S Offline
          S Offline
          samdol
          wrote on last edited by
          #4

          @LuGRU
          In here
          It says
          Second, it is probably impossible to build a static version of Qt Creator because of the lack of support for plugins in a static environment.
          Does it mean that I cannot use plugin to support various image format?

          mrjjM 1 Reply Last reply
          0
          • S samdol

            @LuGRU
            In here
            It says
            Second, it is probably impossible to build a static version of Qt Creator because of the lack of support for plugins in a static environment.
            Does it mean that I cannot use plugin to support various image format?

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

            @samdol
            No it means that Creator, the Qt IDE / Editor cannot be build as a static
            Qt application as it really needs to use dynamic loading.

            You can however create a new Image Plugin and static link with your application.
            But you cannot mix statically compiled Qt App and then use plugins dynamically.

            So you cannot have static Qt app and dynamic loading plugins.
            Meaning your STATIC linked App cannot at runtime load extra plugins.
            BUt you are free to link new ones in and that way support new formats.

            Can I ask what image format you want to add?

            Also if dynamic loading is important, why use static linking ?

            S 1 Reply Last reply
            4
            • L Offline
              L Offline
              LuGRU
              wrote on last edited by LuGRU
              #6

              @samdol
              I think You did read this out of context, see:

              There are at least two reasons for not building static versions of the GUI tools. First, releasing a new version of an application is typically a task that you automate using a script and there is no need for GUI tools at this stage. Second, it is probably impossible to build a static version of Qt Creator because of the lack of support for plugins in a static environment. 
              

              This paragraph talks about QtCreator and it's plugins. QtCreator uses multiple "plugins", see QtCreator -> About Plugins page and I do suspect that this do refer to some of them (Device support ???).

              As I said before QImageIOPlugin do support static linkage. Case in point iOS. Deploying Qt app on iOS is statically linked and it do support images.

              PS. @mrjj replied while I was typing.

              1 Reply Last reply
              1
              • mrjjM mrjj

                @samdol
                No it means that Creator, the Qt IDE / Editor cannot be build as a static
                Qt application as it really needs to use dynamic loading.

                You can however create a new Image Plugin and static link with your application.
                But you cannot mix statically compiled Qt App and then use plugins dynamically.

                So you cannot have static Qt app and dynamic loading plugins.
                Meaning your STATIC linked App cannot at runtime load extra plugins.
                BUt you are free to link new ones in and that way support new formats.

                Can I ask what image format you want to add?

                Also if dynamic loading is important, why use static linking ?

                S Offline
                S Offline
                samdol
                wrote on last edited by
                #7

                @mrjj
                Thank you mrjj and LuGRU,
                It seems the static liking to Plugin is the way to go. Dynamic loading is not important.
                For now, I would like to support RAF CRW image formats.
                And enventually I need to support pcx, pnm, psd, rgb, eps and NEF formats.

                mrjjM 1 Reply Last reply
                0
                • S samdol

                  @mrjj
                  Thank you mrjj and LuGRU,
                  It seems the static liking to Plugin is the way to go. Dynamic loading is not important.
                  For now, I would like to support RAF CRW image formats.
                  And enventually I need to support pcx, pnm, psd, rgb, eps and NEF formats.

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

                  @samdol
                  Hi
                  PSD itself is pretty hardcore. Maybe this can provide starting point
                  https://github.com/Code-ReaQtor/libqpsd

                  S 1 Reply Last reply
                  0
                  • mrjjM mrjj

                    @samdol
                    Hi
                    PSD itself is pretty hardcore. Maybe this can provide starting point
                    https://github.com/Code-ReaQtor/libqpsd

                    S Offline
                    S Offline
                    samdol
                    wrote on last edited by
                    #9

                    @mrjj
                    Do I have to use plugin to show raw format image file?

                    mrjjM 1 Reply Last reply
                    0
                    • S samdol

                      @mrjj
                      Do I have to use plugin to show raw format image file?

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

                      @samdol
                      Hi do you mean a raw image format like in cameras or just raw as in no header etc?
                      http://stackoverflow.com/questions/18637721/how-to-display-a-raw-image-file-in-a-qt-gui

                      S 3 Replies Last reply
                      0
                      • mrjjM mrjj

                        @samdol
                        Hi do you mean a raw image format like in cameras or just raw as in no header etc?
                        http://stackoverflow.com/questions/18637721/how-to-display-a-raw-image-file-in-a-qt-gui

                        S Offline
                        S Offline
                        samdol
                        wrote on last edited by samdol
                        #11
                        This post is deleted!
                        1 Reply Last reply
                        0
                        • mrjjM mrjj

                          @samdol
                          Hi do you mean a raw image format like in cameras or just raw as in no header etc?
                          http://stackoverflow.com/questions/18637721/how-to-display-a-raw-image-file-in-a-qt-gui

                          S Offline
                          S Offline
                          samdol
                          wrote on last edited by
                          #12

                          @mrjj
                          I mean the image format like in cameras, such as CRW, NEF,...

                          mrjjM 1 Reply Last reply
                          0
                          • S samdol

                            @mrjj
                            I mean the image format like in cameras, such as CRW, NEF,...

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

                            @samdol said in Image plugin:

                            CRW

                            Nope, never saw such plugin. For some camera vendors you have to use the SDK to read it.
                            http://amin-ahmadi.com/2016/06/09/how-to-handle-canon-eos-raw-images-in-qt-c/

                            Alternatively, you can use a lib
                            http://www.libraw.org/
                            and use to convert to format that you can
                            load or embed into Qt app so it can load native.

                            S 1 Reply Last reply
                            1
                            • mrjjM mrjj

                              @samdol said in Image plugin:

                              CRW

                              Nope, never saw such plugin. For some camera vendors you have to use the SDK to read it.
                              http://amin-ahmadi.com/2016/06/09/how-to-handle-canon-eos-raw-images-in-qt-c/

                              Alternatively, you can use a lib
                              http://www.libraw.org/
                              and use to convert to format that you can
                              load or embed into Qt app so it can load native.

                              S Offline
                              S Offline
                              samdol
                              wrote on last edited by
                              #14

                              @mrjj
                              Thank you for the link.
                              Is the libraw OK to be used on commercial project?
                              Do I have to buy the license to use in commercial project?

                              1 Reply Last reply
                              0
                              • M Offline
                                M Offline
                                mchinand
                                wrote on last edited by
                                #15

                                See the licensing options for libraw here. If you adhere to the terms of one of these licenses you can probably use it in a commercial project.

                                1 Reply Last reply
                                1
                                • mrjjM mrjj

                                  @samdol
                                  Hi do you mean a raw image format like in cameras or just raw as in no header etc?
                                  http://stackoverflow.com/questions/18637721/how-to-display-a-raw-image-file-in-a-qt-gui

                                  S Offline
                                  S Offline
                                  samdol
                                  wrote on last edited by
                                  #16

                                  @mrjj

                                  From the link, it seems we need to know
                                  width, height ,QImage::Format about the raw image file before read it.
                                  Could we know those information before read it?

                                  mrjjM 1 Reply Last reply
                                  0
                                  • S samdol

                                    @mrjj

                                    From the link, it seems we need to know
                                    width, height ,QImage::Format about the raw image file before read it.
                                    Could we know those information before read it?

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

                                    @samdol said in Image plugin:

                                    Could we know those information before read it?

                                    Not really. That is why raw means many things.
                                    One can guess about it if knowing color format/depth and the filesize but
                                    ultimately it could be anything.

                                    For Cameras the raw format means uncompressed. Each vendor might save raw differently and hence
                                    its not easy to "just" read raw files.

                                    S 1 Reply Last reply
                                    1
                                    • mrjjM mrjj

                                      @samdol said in Image plugin:

                                      Could we know those information before read it?

                                      Not really. That is why raw means many things.
                                      One can guess about it if knowing color format/depth and the filesize but
                                      ultimately it could be anything.

                                      For Cameras the raw format means uncompressed. Each vendor might save raw differently and hence
                                      its not easy to "just" read raw files.

                                      S Offline
                                      S Offline
                                      samdol
                                      wrote on last edited by
                                      #18

                                      @mrjj
                                      when tried the code in the link with some raw files (NiKON NEF, ..) I could only see unrecognizable dots on the screen. Is it because I did not put the right w, h and format?

                                      mrjjM 1 Reply Last reply
                                      0
                                      • S samdol

                                        @mrjj
                                        when tried the code in the link with some raw files (NiKON NEF, ..) I could only see unrecognizable dots on the screen. Is it because I did not put the right w, h and format?

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

                                        @samdol
                                        Yes if you specify wrong parameters for the format it will look distorted.

                                        S 1 Reply Last reply
                                        1
                                        • mrjjM mrjj

                                          @samdol
                                          Yes if you specify wrong parameters for the format it will look distorted.

                                          S Offline
                                          S Offline
                                          samdol
                                          wrote on last edited by
                                          #20

                                          @mrjj
                                          I saw some image Viewer shows raw image file. I wonder how it could read raw image. Because in order to read it correctly, we need to know the w, h, format in advance and there is no way to know w,h, format.

                                          1 Reply Last reply
                                          0

                                          • Login

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