Re: LZW decode for images - syntax



On Tue, 13 Sep 2005 08:32:26 -0700, Namit Bhalla wrote:

> Hi,
> I have a monochrome bitmap image that I compress using LZW and send to
> a printer. Can anyone please clarify if the following syntax is
> correct:
>
> width height 1 [width 0 0 height 0 0] currentfile /LZWDecode filter
> image {LZW compressed data}
>
> I have the following grey areas:
> 1. How to specify the compressed data which is in binary format?

Encode as ASCII. Use either HEX or ASCII85

> Should I enclose it in angular brackets <> ?

Not when reading from currentfile you just need the end marker.

Example:

%!
54 112 translate
120 120 scale
/SIZE 24 def
/DeviceGray setcolorspace
<<
/ImageType 1
/Width SIZE
/Height SIZE
/BitsPerComponent 1
/Decode [0 1]
/ImageMatrix [SIZE 0 0 SIZE neg 0 SIZE]
/DataSource currentfile /ASCII85Decode filter /LZWDecode filter
>>
image
J,fg^!!&Sr,X;Hg,QNZH5SR?,#E*&Bebk42^X7UQpeWpTE=Mtb6\*,YpiaCf9=>K"hLl`LfKk9hn/OUl
!T/D-)rL];$igD$kTq"(7fYe>~>

showpage



> 2. I understand that the standard LZW algorithm has no provision for
> EOD marker. So, should I add the EOD myself after the compressed data?
> Is this EOD marker always 257 for LZW?


Yes.

.



Relevant Pages

  • Re: Tricky LZW Decompression
    ... because it is an image format, the tif variant of lzw compression would ... or 16 bits (unix compress). ...
    (comp.compression)
  • LZW decode for images - syntax
    ... I have a monochrome bitmap image that I compress using LZW and send to ... Is this EOD marker always 257 for LZW? ...
    (comp.lang.postscript)
  • Re: LZW decode for images - syntax
    ... >>> I have a monochrome bitmap image that I compress using LZW and send to ... >Do you mean to say that I can never pass binary data (output of my LZW ...
    (comp.lang.postscript)
  • Re: LZW decode for images - syntax
    ... >> I have a monochrome bitmap image that I compress using LZW and send to ... How to specify the compressed data which is in binary format? ...
    (comp.lang.postscript)
  • Problem writing compressed data to disk
    ... fun to compress a text file and write it to a disk file. ... Create a DeflateStream by wrapping up a MemoryStream. ... Write the compressed data into the underline stream (the ... Call the MemoryStream's Write method to dump the compressed data ...
    (microsoft.public.dotnet.languages.csharp)