You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@pdfbox.apache.org by Daniel Wilson <wi...@gmail.com> on 2009/05/01 01:36:50 UTC

Re: PDPixelMap.getRGBImage() -- I think I found the problem

>>This gets confusing. Maybe we need to take a concrete PDF as example and
discuss it.

Quite!

I'm looking at PDFBox\trunk\test\input\rendering\ArchiveRGB.ai.

The PNG that is posted with it lacks the stencil mask.  The stencil mask, as
I've implemented it, on this one puts a white screen over most of it and
some gibberish dots near the top.

Obviously, the stencil mask handling is wrong in this case (though it's much
closer in most others).  This is Separation with an alternate colors space
that is ICCBased.

The raw PDF source that seems to have to do with this is:
31 0 obj
[/Separation/J80-NAVY 24 0 R<</C0[0.0 0.0 0.0 0.0]/C1[0.992157 0.835297
0.44313 0.46666]/FunctionType 2/N 1.0/Domain[0 1]/Range[0.0 1.0 0.0 1.0 0.0
1.0 0.0 1.0]>>]
endobj

Though this one also has something to do with that ... this actually has the
ImageMask flag set:
26 0 obj
<</Intent/RelativeColorimetric/Subtype/Image/Length
96956/Filter/FlateDecode/Name/X/ImageMask true/BitsPerComponent 1/Width
1188/DecodeParms<</Columns 1188/Predictor 15/BitsPerComponent 1/Colors
1>>/Height 1188/Type/XObject/Decode[0.0 1.0]>>stream

and again:
28 0 obj
<</Intent/RelativeColorimetric/Subtype/Image/Length
57146/Filter/FlateDecode/Name/X/ImageMask true/BitsPerComponent 1/Width
864/DecodeParms<</Columns 864/Predictor 15/BitsPerComponent 1/Colors
1>>/Height 864/Type/XObject/Decode[0.0 1.0]>>stream

Why do I think it's IICBased?  Well, that's the branch of logic it's taking
in PDFBox.  I can't tell at this point whether that's right or wrong.

Thanks again for any guidance here!

Daniel


On Thu, Apr 30, 2009 at 2:20 AM, Jeremias Maerki <de...@jeremias-maerki.ch>wrote:

> On 30.04.2009 01:46:31 Daniel Wilson wrote:
> > OK, I'm changing over to 4 spaces.  You're right, SCite has that option.
> >
> > I'm trying to run ant checkstyle, but am getting a
> > UnsupportedClassVersionError.  I think this is b/c I'm running jdk 1.4 --
> > which I'm doing to ensure I do not accidentally introduce something
> > supported only in newer versions of Java.
> >
> > Do you have suggestions on this?
>
> I've configured Checkstyle in Eclipse which is running Java 6 but PDFBox
> is configured to compile with Java 1.4, so I don't have that problem.
>
> I think you can also just run Checkstyle from Ant with Java >1.4 but
> compile with Java 1.4. I've set up some scripts that let me switch JDKs
> easily by changing the JAVA_HOME env variable.
>
> > >> I read this as only relevant if you are using DataBuffer.TYPE_BYTE
> (for
> > example) and per component less than 8 bits are used.
> >
> > Which is exactly what we're dealing with.
>
> Not in the case I've cited: PDICCBased. It uses ComponentColorModel, not
> IndexColorModel. We have to keep "components" apart from "samples". When
> an XObject uses an /ICCBased color space it usually (!) has 8 bits per
> components and n components. But an XObject could also use a /Indexed
> color space with an /ICCBased color space as base in which case PDFBox
> would have to build an IndexColorModel-like instance that is based on an
> arbitrary ICC_ColorSpace (rather than sRGB).
>
> This gets confusing. Maybe we need to take a concrete PDF as example and
> discuss it.
>
> > Is there a better way to initialize the array?  Providing it with the
> number
> > of elements it needs?
> >
> > Thanks.
> >
> > Daniel Wilson
> <snip/>
>
>
> Jeremias Maerki
>
>

Re: PDPixelMap.getRGBImage() -- I think I found the problem

Posted by Daniel Wilson <wi...@gmail.com>.
never mind what I just said.  Your insistence on IndexedColorModel -- it's
finally sinking in ... and getting better results!

Thanks!

On Thu, Apr 30, 2009 at 7:36 PM, Daniel Wilson <
williamstonconsulting@gmail.com> wrote:

> >>This gets confusing. Maybe we need to take a concrete PDF as example and
> discuss it.
>
> Quite!
>
> I'm looking at PDFBox\trunk\test\input\rendering\ArchiveRGB.ai.
>
> The PNG that is posted with it lacks the stencil mask.  The stencil mask,
> as I've implemented it, on this one puts a white screen over most of it and
> some gibberish dots near the top.
>
> Obviously, the stencil mask handling is wrong in this case (though it's
> much closer in most others).  This is Separation with an alternate colors
> space that is ICCBased.
>
> The raw PDF source that seems to have to do with this is:
> 31 0 obj
> [/Separation/J80-NAVY 24 0 R<</C0[0.0 0.0 0.0 0.0]/C1[0.992157 0.835297
> 0.44313 0.46666]/FunctionType 2/N 1.0/Domain[0 1]/Range[0.0 1.0 0.0 1.0 0.0
> 1.0 0.0 1.0]>>]
> endobj
>
> Though this one also has something to do with that ... this actually has
> the ImageMask flag set:
> 26 0 obj
> <</Intent/RelativeColorimetric/Subtype/Image/Length
> 96956/Filter/FlateDecode/Name/X/ImageMask true/BitsPerComponent 1/Width
> 1188/DecodeParms<</Columns 1188/Predictor 15/BitsPerComponent 1/Colors
> 1>>/Height 1188/Type/XObject/Decode[0.0 1.0]>>stream
>
> and again:
> 28 0 obj
> <</Intent/RelativeColorimetric/Subtype/Image/Length
> 57146/Filter/FlateDecode/Name/X/ImageMask true/BitsPerComponent 1/Width
> 864/DecodeParms<</Columns 864/Predictor 15/BitsPerComponent 1/Colors
> 1>>/Height 864/Type/XObject/Decode[0.0 1.0]>>stream
>
> Why do I think it's IICBased?  Well, that's the branch of logic it's taking
> in PDFBox.  I can't tell at this point whether that's right or wrong.
>
> Thanks again for any guidance here!
>
> Daniel
>
>
>
> On Thu, Apr 30, 2009 at 2:20 AM, Jeremias Maerki <de...@jeremias-maerki.ch>wrote:
>
>> On 30.04.2009 01:46:31 Daniel Wilson wrote:
>> > OK, I'm changing over to 4 spaces.  You're right, SCite has that option.
>> >
>> > I'm trying to run ant checkstyle, but am getting a
>> > UnsupportedClassVersionError.  I think this is b/c I'm running jdk 1.4
>> --
>> > which I'm doing to ensure I do not accidentally introduce something
>> > supported only in newer versions of Java.
>> >
>> > Do you have suggestions on this?
>>
>> I've configured Checkstyle in Eclipse which is running Java 6 but PDFBox
>> is configured to compile with Java 1.4, so I don't have that problem.
>>
>> I think you can also just run Checkstyle from Ant with Java >1.4 but
>> compile with Java 1.4. I've set up some scripts that let me switch JDKs
>> easily by changing the JAVA_HOME env variable.
>>
>> > >> I read this as only relevant if you are using DataBuffer.TYPE_BYTE
>> (for
>> > example) and per component less than 8 bits are used.
>> >
>> > Which is exactly what we're dealing with.
>>
>> Not in the case I've cited: PDICCBased. It uses ComponentColorModel, not
>> IndexColorModel. We have to keep "components" apart from "samples". When
>> an XObject uses an /ICCBased color space it usually (!) has 8 bits per
>> components and n components. But an XObject could also use a /Indexed
>> color space with an /ICCBased color space as base in which case PDFBox
>> would have to build an IndexColorModel-like instance that is based on an
>> arbitrary ICC_ColorSpace (rather than sRGB).
>>
>> This gets confusing. Maybe we need to take a concrete PDF as example and
>> discuss it.
>>
>> > Is there a better way to initialize the array?  Providing it with the
>> number
>> > of elements it needs?
>> >
>> > Thanks.
>> >
>> > Daniel Wilson
>> <snip/>
>>
>>
>> Jeremias Maerki
>>
>>
>