You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by "John Hewson (JIRA)" <ji...@apache.org> on 2015/02/12 04:44:12 UTC

[jira] [Commented] (PDFBOX-2681) Colors inaccurate rastered CMYK source w/ gradient + photo

    [ https://issues.apache.org/jira/browse/PDFBOX-2681?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14317528#comment-14317528 ] 

John Hewson commented on PDFBOX-2681:
-------------------------------------

{quote}
Color hue is wrong. Is this a CMYK to RGB issue?
{quote}

I know it's not expected, but it's actually the intended behaviour. The PDFs you've attached use the DeviceCMYK color space, which is device-dependent (i.e. it represents the physical inks available in a specific printing process and not any sort of standard, convertible color space). If you want reproducible color then you'll need to use one of the CIE-based color spaces which are available in PDF, which even allow for embedding ICC profiles. 

In case you're wondering, internally PDFBox uses "ISO Coated v2 300%" as its DeviceCMYK profile while Acrobat uses "US Web Coated (SWOP) v2". Unfortunately we're not allowed to redistribute the Adobe profile, so we can't provide exactly the same DeviceCMYK as Acrobat.

If you do have a copy of the Adobe profile, you can use it with PDFBox by creating your own subclass of PDDeviceCMYK which overrides getICCProfile and then calling PDDeviceCMYK.INSTANCE = foo, where foo is an instance of your subclass. You'll need to check the terms of the profile license first, to see what usage is permitted.

{quote}
Opacity of gradient is wrong and much different. The jpg from Illustrator shows much more of the photo without a gradient over it.
{quote}

Yes, though I don't think it's an opacity issue, it looks more like the gradient's function is somehow wrong, as if its been stretched out across the entire width of the image rather than filling only half of it. It's x-position is also off by quite a few pixels. [~tilman] might have some thoughts on this.

> Colors inaccurate rastered CMYK source w/ gradient + photo
> ----------------------------------------------------------
>
>                 Key: PDFBOX-2681
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2681
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>         Environment: Tested on OS X 10.10, Java 1.6 / 1.8
>            Reporter: Jon Wu
>         Attachments: gradient-test-illustrator.jpg, gradient-test-pdfbox.jpg, gradient-test-photo-illustrator.jpg, gradient-test-photo-pdfbox.jpg, gradient-test-photo.pdf, gradient-test.pdf
>
>
> In the attached gradient-test-photo.pdf, there's a photo with a gradient on top of it. The colors in the gradient are CMYK. When rasterizing this test file with PDFBox 2.0.0 SNAPSHOT 20150209, the resulting image's gradient is different from the original and the colors of the photo under the gradient look significantly different vs the display in Adobe tools like Illustrator or other compliant PDF readers.
> Issues:
> - Color hue is wrong. Is this a CMYK to RGB issue?
> - Opacity of gradient is wrong and much different. The jpg from Illustrator shows much more of the photo without a gradient over it.
> Without a photo, there's still a difference, but it's much harder to see. Example in gradient-test.pdf where the same gradient is drawn over a grey rectangle.
> If I convert the PDF to RGB in Illustrator first and rasterize the RGB PDF with PDFBox, the result is nearly identical between Illustrator and PDFBox so this seems like a CMYK conversion issue in both the general color conversion and maybe how the gradient is calculated.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@pdfbox.apache.org
For additional commands, e-mail: dev-help@pdfbox.apache.org