[ 
https://issues.apache.org/jira/browse/PDFBOX-2324?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Tilman Hausherr updated PDFBOX-2324:
------------------------------------
    Attachment: gwg080_devicen-support_6c_x3.pdf-1.png

The problem image on the left is an index colorspace, which references a 
DeviceN colorspace. 
To create the index PDFBox uses a height 1 BufferedImage that has all the 
colors in a row. 
It doesn't have to, but typically that image is a gradient.
For this file, two such images are created, one is a gradient, the other one 
has the same "crazy" colors as seen in the rendering.

The alternate colorspace of the DeviceN colorspace is a Lab colorspace. PDFBox 
converts the DeviceN values to Lab values, for which a type 4 function is used. 
Type4 functions are made of a subset of postscript commands. (I traced through 
the type 4 function, it works as described) 

PDDeviceN divides the values by 255 before calling the function. After the 
function, it multiplies them with 255. Which is not correct, because the 
function returns values that are in the /Range [0.0 100.0 -128.0 127.0 -128.0 
127.0]. 
These incorrect values are then assigned to the raster, which probably makes a 
modulo 255, so "crazy" colors appear.

A first solution was to assign the values "as is" to the raster. For the first 
time the turtle on the left appeared, although in green.

That indicates that there must be some adjustment before assigning to the 
raster. However this would mean putting colorspace-specific code.

Instead I switched to using the pixel converter. (See also PDFBOX-1997 which 
had a similar problem).

> Failure to render DeviceN image
> -------------------------------
>
>                 Key: PDFBOX-2324
>                 URL: https://issues.apache.org/jira/browse/PDFBOX-2324
>             Project: PDFBox
>          Issue Type: Bug
>          Components: Rendering
>    Affects Versions: 2.0.0
>            Reporter: Tilman Hausherr
>              Labels: CIELAB, DeviceN
>         Attachments: GWG080_DeviceN-Support_6c_x3.pdf, 
> GWG080_DeviceN-Support_6c_x31.jpg, gwg080_devicen-support_6c_x3.pdf-1.png
>
>
> For the attached test PDF, the left image is rendered incorrect.



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

Reply via email to