PDF and LZW predictor

  • Follow


I'm asking about the correct way of writing predictor value for LZW
compressed data in PDF file ?

I have a compressed LZW data which is compressed using predcitor of
value 2
I want to insert this data in PDF file, but I do not know how.

I could insert LZW compressed data that has no predictor and it works
fine, but when I could not do this with LZW compressed data that has
predictor.

I used to write the following  in the PDF file, but it did not work
and the file is opened with incorrect colors.

I'm asking about the correct way of writing predictor value for LZW
compressed data in PDF file ?

..
..
..
/DecodeParms 
[   <<./Predictor 2.>> ]
/Filter [  /LZWDecode ]
..
..
..
..
0
Reply anton_yaki 7/18/2004 12:21:01 PM

Anton <anton_yaki@hotmail.com> wrote:
>I'm asking about the correct way of writing predictor value for LZW
>compressed data in PDF file ?
>
>I have a compressed LZW data which is compressed using predcitor of
>value 2
>I want to insert this data in PDF file, but I do not know how.
>
>I could insert LZW compressed data that has no predictor and it works
>fine, but when I could not do this with LZW compressed data that has
>predictor.
>
>I used to write the following  in the PDF file, but it did not work
>and the file is opened with incorrect colors.
>
>I'm asking about the correct way of writing predictor value for LZW
>compressed data in PDF file ?

Here is an example:

17 0 obj <<
/Type /XObject
/Subtype /Image
/Width 32
/Height 32
/BitsPerComponent 2
/ColorSpace /DeviceGray
/Length 31
/Filter /FlateDecode
/DecodeParms << /Colors 1 /Columns 32 /BitsPerComponent 2 /Predictor 10
>>
stream
....
endstream
endobj

The /Predictor 10 (PNG prediction) is only a default value, the 10 is not
used, since the actual prediction is selected on a line-by-line basis,
see the PDF reference. The predictor value must come as algorithm tag
at the begin of every line in the stream. But I don't know how in detail
it's hidden in the stream. Normally you need not care, as you can directly
copy the LZW data chunks into the PDF stream under certain circumstances,
see. e. g. Thomas Merz' PDFlib, file p_png.c "SPNG - Simple PNG".

Regards, Hartmut
-- 
H. Henkel, Oftersheim
0
Reply hartmut_henkel 7/18/2004 9:46:44 PM


1 Replies
516 Views

(page loaded in 0.05 seconds)

Similiar Articles:







7/23/2012 1:21:32 AM


Reply: