ICEpdf
  1. ICEpdf
  2. PDF-15

Wrong color in view when CMYK doesn't provide all values

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0
    • Fix Version/s: 4.0 - Beta, 4.0
    • Component/s: Core/Parsing
    • Labels:
      None
    • Environment:
      java version "1.6.0_10"
      linux

      Description

      When viewing some CMYK pdf files the color seems wrong (in my case black instead of red).

      The reason for this seems to be that not all CMYK values are provided (in my case only MYK values). This can be fixed by applying the following patch
      File: ./src/org/icepdf/core/pobjects/graphics/DeviceN.java

          public Color getColor(float[] f) {
              if (func == null) {
                 if (alternate.getNumComponents() > f.length) {
                      float[] ftmp = new float[alternate.getNumComponents()];
                      for (int index = 0; index < f.length && index < names.size(); index++) {
                          if (names.get(index).equals("Cyan")) {
                              ftmp[0] = f[index];
                          }
                          if (names.get(index).equals("Magenta")) {
                              ftmp[1] = f[index];
                          }
                          if (names.get(index).equals("Yellow")) {
                              ftmp[2] = f[index];
                          }
                          if (names.get(index).equals("Black")) {
                              ftmp[3] = f[index];
                          }
                      }
                      f = ftmp;
                  }
                  float y[] = new float[alternate.getNumComponents()];
                  for (int i = 0; i < Math.min(y.length, f.length); i++) {
                      y[i] = f[i];
                  }

                  return alternate.getColor(y);
              }
              float y[] = func.calculate(f);
              if (colorspaces[0] != null) {
                  return colorspaces[0].getColor(reverse(y));
              }
              return alternate.getColor(reverse(y));
          }

        Activity

        Roy Van Der Kuil created issue -
        Hide
        Roy Van Der Kuil added a comment -

        This file shows the wrong colors when opening in the unpatched 3.0 version

        Show
        Roy Van Der Kuil added a comment - This file shows the wrong colors when opening in the unpatched 3.0 version
        Roy Van Der Kuil made changes -
        Field Original Value New Value
        Attachment uniekekans.pdf [ 11742 ]
        Roy Van Der Kuil made changes -
        Attachment uniekekans.pdf [ 11742 ]
        Hide
        Roy Van Der Kuil added a comment -

        This file is redered in black when it should be red.

        Show
        Roy Van Der Kuil added a comment - This file is redered in black when it should be red.
        Roy Van Der Kuil made changes -
        Attachment uniekekans_test verloop.pdf [ 11743 ]
        Hide
        Patrick Corless added a comment -

        Thanks for the path Roy! I'll try and get this checked into the trunk early this week.

        Show
        Patrick Corless added a comment - Thanks for the path Roy! I'll try and get this checked into the trunk early this week.
        Patrick Corless made changes -
        Salesforce Case []
        Fix Version/s 3.1 [ 10181 ]
        Hide
        Roy Van Der Kuil added a comment -

        Hi,

        Any news on the status of this patch?

        And is there a download link for the 3.1 snapshot version? (svn or otherwise)

        Show
        Roy Van Der Kuil added a comment - Hi, Any news on the status of this patch? And is there a download link for the 3.1 snapshot version? (svn or otherwise)
        Patrick Corless made changes -
        Status Open [ 1 ] In Progress [ 3 ]
        Hide
        Patrick Corless added a comment -

        Hi Roy; could I trouble you to fill out and contributors agreement? You can review it here, http://www.icepdf.org/community/contribute.html

        Show
        Patrick Corless added a comment - Hi Roy; could I trouble you to fill out and contributors agreement? You can review it here, http://www.icepdf.org/community/contribute.html
        Patrick Corless made changes -
        Salesforce Case []
        Affects Version/s 3.2 [ 10212 ]
        Affects Version/s 3.0 [ 10180 ]
        Patrick Corless made changes -
        Salesforce Case []
        Fix Version/s 3.2 [ 10212 ]
        Fix Version/s 3.1 [ 10181 ]
        Affects Version/s 3.0 [ 10180 ]
        Affects Version/s 3.2 [ 10212 ]
        Hide
        Roy Van Der Kuil added a comment -

        I e-mailed the contributors agreement.

        Show
        Roy Van Der Kuil added a comment - I e-mailed the contributors agreement.
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #19698 Mon Nov 16 08:22:10 MST 2009 patrick.corless PDF-15 updated DeviceN colour space to handle CMYK alternative colour space correctly. From community member Roy Van Der Kuil.
        Files Changed
        Commit graph MODIFY /icepdf/trunk/icepdf/core/src/org/icepdf/core/pobjects/graphics/DeviceN.java
        Hide
        Patrick Corless added a comment -

        Applied the patch supplied by Roy. Many thanks.

        Show
        Patrick Corless added a comment - Applied the patch supplied by Roy. Many thanks.
        Patrick Corless made changes -
        Status In Progress [ 3 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Fix Version/s 4.0 [ 10222 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Patrick Corless
            Reporter:
            Roy Van Der Kuil
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: