Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. General talk
  3. Announcements
  4. Libqpsd - Qt/C++ plugin for Photoshop Document (PSD/PSB )
QtWS25 Last Chance

Libqpsd - Qt/C++ plugin for Photoshop Document (PSD/PSB )

Scheduled Pinned Locked Moved Announcements
22 Posts 6 Posters 21.1k 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.
  • C Offline
    C Offline
    Code_ReaQtor
    wrote on 19 Apr 2013, 07:57 last edited by
    #10

    [quote author="sfiel" date="1366267531"]Hi,

    we just integrated libqpsd to our image viewer (http://www.nomacs.org) .... it's really easy to use, the images look very good and we were all surprised by the loading times - you are fast as hell :)

    Thanks for sharing this great piece of code with the community

    Greetings [/quote]

    You're welcome!!! :D

    Update: I am already working on PSB (Photoshop Big / Large Document Format) support and my initial codes are a success. I just need more time to test the codes on other color modes of PSB.

    (I don't have much PSB files on my machine and I am still searching for sites/people/friends who can give me a copy of their PSD/PSB files that are NOT on RGB mode. Thanks!)

    Please visit my open-source projects at https://github.com/Code-ReaQtor.

    1 Reply Last reply
    0
    • A Offline
      A Offline
      asgohtals
      wrote on 19 Apr 2013, 09:42 last edited by
      #11

      hi,

      i have added some psbs to our ftp:
      "ftp://scruffy.caa.tuwien.ac.at/staff/diem/small-psb.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/small-psb.zip
      "ftp://scruffy.caa.tuwien.ac.at/staff/diem/not-that-small-psb.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/not-that-small-psb.zip
      the zips contain 3 images in Lab, CMYK and quadtone

      I hope they are of use for you.

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on 19 Apr 2013, 09:59 last edited by
        #12

        Thank you!

        I will work on these, ASAP! :D

        Please visit my open-source projects at https://github.com/Code-ReaQtor.

        1 Reply Last reply
        0
        • C Offline
          C Offline
          Code_ReaQtor
          wrote on 19 Apr 2013, 13:17 last edited by
          #13

          [quote author="asgohtals" date="1366364540"]hi,

          i have added some psbs to our ftp:
          "ftp://scruffy.caa.tuwien.ac.at/staff/diem/small-psb.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/small-psb.zip
          "ftp://scruffy.caa.tuwien.ac.at/staff/diem/not-that-small-psb.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/not-that-small-psb.zip
          the zips contain 3 images in Lab, CMYK and quadtone

          I hope they are of use for you.

          [/quote]

          Thank you again for there images! They were all very nice and libqpsd were able to read them!

          However, there still a bug in the Lab to RGB conversion and several pixels in the "wall-small-Lab.psb" are MISCALCULATED. The conversion algorithm were contributed by Yuezhao and we still don't have a perfect reference for the method other than "EasyRGB.com":http://www.easyrgb.com/

          Morever, I will update the libqpsd repository tonight :) Feel free to check it.

          Please visit my open-source projects at https://github.com/Code-ReaQtor.

          1 Reply Last reply
          0
          • A Offline
            A Offline
            asgohtals
            wrote on 17 May 2013, 14:19 last edited by
            #14

            I have found a psd (CMYK) with wrong color conversions:
            "ftp://scruffy.caa.tuwien.ac.at/staff/diem/libpsd-cmyk.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/libpsd-cmyk.zip
            we currently use the lipqpsd version from the ~17.04.2013 unfortunately, I cannot test it with the current github version as imageData.size() (qpsdhandler.cpp::730) is 0 for this image (did some interfaces change except for the refactoring?).

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Code_ReaQtor
              wrote on 18 May 2013, 07:21 last edited by
              #15

              [quote author="asgohtals" date="1368800361"]I have found a psd (CMYK) with wrong color conversions:
              "ftp://scruffy.caa.tuwien.ac.at/staff/diem/libpsd-cmyk.zip":ftp://scruffy.caa.tuwien.ac.at/staff/diem/libpsd-cmyk.zip
              we currently use the lipqpsd version from the ~17.04.2013 unfortunately, I cannot test it with the current github version as imageData.size() (qpsdhandler.cpp::730) is 0 for this image (did some interfaces change except for the refactoring?).
              [/quote]

              Thank you for the image file. I just found out that it has 5 channels: cyan, magenta, yellow, key, and alpha... which is not actually tested with a real psd file. The original code takes the image in the arrangement A-C-M-Y-K which is incorrect. It should be C-M-Y-K-A. I just updated it with the bug fix.

              The new code should be working... to be sure try building it with the following lines uncommented:
              @
              qpsdhandler.cpp::25 //#include <QDebug>
              qpsdhandler.cpp::372-382 //#verification
              @

              If possible, use it on Qt Creator to get the debug output (when opening a psd file) then send me those outputs. Thanks.

              EDIT: Possible reason for imageData.size() becoming zero was that it falls under "Zip with/without prediction" type of compression. Currently, it ONLY supports Raw and RLE.

              Please visit my open-source projects at https://github.com/Code-ReaQtor.

              1 Reply Last reply
              0
              • A Offline
                A Offline
                asgohtals
                wrote on 21 May 2013, 12:29 last edited by
                #16

                hi again,
                you have added:
                @if (format() == "psd") { // line 266...@

                to distinguish between psd/psb. The problem is, that we provide QPsdHandler directly with a buffer. Hence, the format() returns an empty string. Then, the compression value is loaded wrongly since in qpsdhandler.cpp::269 the skipRawData command is not executed. -However, for some cases (e.g. file prefetching) it would be cool to be able to call QPsdHandler with (already) loaded buffers.-
                EDIT: now that I have found how to set the 'format' properly, we can work with buffers & whatever we want...
                The call that didn't work was something like that (without line 10):
                @
                bool DkBasicLoader::loadPSDFile(QFileInfo fileInfo) {

                QFile file(fileInfo.absoluteFilePath());
                file.open(QIODevice::ReadOnly);

                QPsdHandler psdHandler;
                psdHandler.setDevice(&file); // QFile is an IODevice

                // EDIT: fixes the issues described:
                psdHandler.setFormat(fileInfo.suffix().toLocal8Bit());

                if (psdHandler.canRead(&file))
                return psdHandler.read(&this->qImg);

                return false;
                }
                @

                by the way, thanks for the fast CMYKA fix : )

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Code_ReaQtor
                  wrote on 21 May 2013, 14:19 last edited by
                  #17

                  [quote author="asgohtals" date="1369139349"]hi again,
                  you have added:
                  @if (format() == "psd") { // line 266...@ [/quote]

                  Yeah, I added it since the "psb" update. There is a difference between "Layer and Mask Info Length" of PSD (4 bytes) and PSB (8 bytes) files. I can't find a workaround yet.... but I think the possible solution is to modify the "switch()" statement at line 186 into this:
                  @ //Line 186
                  switch (version) {
                  case 1: setFormat("psd");
                  break;
                  case 2: setFormat("psb");
                  break;
                  default: return false;
                  break;
                  }
                  @

                  I won't update the repository right away, but tell me if this solution works. Thanks!

                  Please visit my open-source projects at https://github.com/Code-ReaQtor.

                  1 Reply Last reply
                  0
                  • A Offline
                    A Offline
                    asgohtals
                    wrote on 22 May 2013, 07:45 last edited by
                    #18

                    I have just tested the modified switch statement - it works perfect (psd & psb). it would be cool if you could add it to the repository : )

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Code_ReaQtor
                      wrote on 24 May 2013, 07:52 last edited by
                      #19

                      I made some major bugfixes today:

                      Lab (w/alpha) to to RGB conversion. "Here":http://www.pixentral.com/show.php?picture=1sbw7IyUMILv6LmcbhxobqtjcQ5N1 is the link to the screenshot.

                      16-bit RGB(A) and CMYK(A) support

                      Used D50 reference (whitepoint) instead of D65.

                      Too bad the image (wall-small-lab.psb) is too big and loading is still very slow. What are the options to prevent the GUI from freezing for some time? QEventLoop? etc?

                      Please visit my open-source projects at https://github.com/Code-ReaQtor.

                      1 Reply Last reply
                      0
                      • A Offline
                        A Offline
                        asgohtals
                        wrote on 25 May 2013, 17:32 last edited by
                        #20

                        The new Lab conversion is very nice.
                        We simply load images in a thread in order to prevent the GUI from freezing:
                        @
                        void DkImageLoader::load(QFileInfo file, bool silent, int cacheState) {

                        // loadFile() does the real loading job
                        QMetaObject::invokeMethod(
                        this,
                        "loadFile",
                        Qt::QueuedConnection,
                        Q_ARG(QFileInfo, file),
                        Q_ARG(bool, silent),
                        Q_ARG(int, cacheState));
                        }
                        @

                        in order to get this working, the 'DkImageLoader' needs to be moved to a worker thread:
                        @
                        // part of the DkImageLoader constructor
                        qRegisterMetaType<QFileInfo>("QFileInfo");
                        loaderThread = new QThread;
                        loaderThread->start();
                        moveToThread(loaderThread);
                        @

                        1 Reply Last reply
                        0
                        • C Offline
                          C Offline
                          Code_ReaQtor
                          wrote on 1 Jun 2013, 09:46 last edited by
                          #21

                          Good day!

                          Almost all color modes (Bitmap, Indexed, Grayscale, RGB, CMYK, Multichannel, Lab) in the following bit depth are supported now: 1bpc, 8 bpc, 16 bpc.

                          All that is left is 32-bpc (HDRI, high-dynamic-range imaging). To render/convert it to 8 bpc (to QImage), it needs to be processed using "tone mapping":http://en.wikipedia.org/wiki/Tone_mapping

                          I don't have any experiences on this and I am out of ideas now, so maybe somebody can help in implementing it.

                          Thanks. I will appreciate any help. :D

                          Please visit my open-source projects at https://github.com/Code-ReaQtor.

                          1 Reply Last reply
                          0
                          • B Offline
                            B Offline
                            bkerdev
                            wrote on 5 Jun 2013, 22:38 last edited by
                            #22

                            [quote author="Code_ReaQtor" date="1353719546"]Greetings!

                            I started coding a plugin for Photoshop Document (PSD/PSB).
                            This library is licensed under GNU LGPL.

                            Critiques, contributors, developers, etc. are all welcome to visit "libqpsd on GitHub":https://github.com/Code-ReaQtor/libqpsd
                            Thanks![/quote]

                            Good Works

                            Boris Bker

                            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