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 last edited by
    #1

    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!

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

    1 Reply Last reply
    0
    • I Offline
      I Offline
      infoctopus
      wrote on last edited by
      #2

      good stuff! You might find something useful in Krita repos..

      Qt rulez

      1 Reply Last reply
      0
      • C Offline
        C Offline
        Code_ReaQtor
        wrote on last edited by
        #3

        [quote author="infoctopus" date="1358333656"]good stuff! You might find something useful in Krita repos..[/quote]

        Thanks!

        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 last edited by
          #4

          "libqpsd":https://github.com/Code-ReaQtor/libqpsd now supports CMYK color mode!

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

          1 Reply Last reply
          0
          • J Offline
            J Offline
            Jake007
            wrote on last edited by
            #5

            Hi!

            Does this plugin have support for layers (access each layer as a separate image) and December 2012 psd file specification?

            Otherwise it looks awesome and may come in handy.


            Code is poetry

            1 Reply Last reply
            0
            • C Offline
              C Offline
              Code_ReaQtor
              wrote on last edited by
              #6

              [quote author="Jake007" date="1364633374"]Hi!

              Does this plugin have support for layers (access each layer as a separate image) and December 2012 psd file specification?

              Otherwise it looks awesome and may come in handy.[/quote]

              Layers - NO
              Dec 2012 PSD Spec - YES

              It was based on the "PSD File Specification":http://www.adobe.com/devnet-apps/photoshop/fileformatashtml/

              I have plans to support reading the "layers" but I still don't have the time to continue it. It only supports reading the "image data". Currently, I am working on reading the "curves" layer for Duotone (mono, duo, tri, quad) color mode. On the other hand, I don't have enough psd images for testing different color modes and using only Photoshop's "convert" feature so development might be a little slow.

              7 out of 8 color modes are already supported (partially). Feel free to try and test it! :D

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

              1 Reply Last reply
              0
              • J Offline
                J Offline
                Jake007
                wrote on last edited by
                #7

                This is gonna be an amazing plugin when it'll be finished.
                There will probably be a dozen different Photoshop versions being made, as they did with webkit and browsers :D .

                But for current project, I unfortunately need something that answers both of my questions with "yes".

                Keep up the good work!


                Code is poetry

                1 Reply Last reply
                0
                • C Offline
                  C Offline
                  Code_ReaQtor
                  wrote on last edited by
                  #8

                  [quote author="Jake007" date="1364647100"]This is gonna be an amazing plugin when it'll be finished.
                  There will probably be a dozen different Photoshop versions being made, as they did with webkit and browsers :D .

                  But for current project, I unfortunately need something that answers both of my questions with "yes".

                  Keep up the good work! [/quote]

                  Thanks!

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

                  1 Reply Last reply
                  0
                  • S Offline
                    S Offline
                    sfiel
                    wrote on last edited by
                    #9

                    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

                    1 Reply Last reply
                    0
                    • C Offline
                      C Offline
                      Code_ReaQtor
                      wrote on 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 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 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 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 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 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 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 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 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 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 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

                                          • Login

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