[gs-devel] Re: Getting a JPX stream's colorspace

Alex Cherepanov alexcher at quadnet.net
Wed Nov 28 18:04:49 PST 2007

Ralph Giles wrote:
> I'd like to get your opinion on how to resolve Bug 689058. That is, when 
> an image dict is missing the /ColorSpace key, the image colorspace 
> should be determined by looking in the JPXDecode filtered stream.
The most straightforward way is code the parsing routine in PostScript
and pre-read the stream. This is not particularly difficult, but not all
color spaces and color depths in JPX are valid PDF values. Probably,
this was the cause of this wart in the spec.

> Is it reasonable to access the stream data 
> itself at that point?
Why not. PDF streams can be read many times.

> If not, where would you suggest?
Probably, a more reusable code would result from a single-pass rendering
but it is _way_ more difficult to code.

> I guess I should provide a .jpxgetcolorspace operator in analogy to 
> .jbig2makeglobalctx and let you implement the rest? Do I need to do 
> anything special to create paletted colorspaces on the stack?
Not all such color spaces are valid in PostScript. Probably, we can just
throw a /limitcheck .

There's another problem. The filter parameters are not handled properly
somewhere near JPXDecode filter. I tried to fix this but didn't finish.


More information about the gs-devel mailing list