Questions tagged [lzw]

LZW (Lempel-Ziv-Welch) is a compression algorithm which supersedes LZ78.

LZW (Lempel-Ziv-Welch) is a compression algorithm which supersedes LZ78.

You can find more information about LZW on Wikipedia.

185 questions
1
vote
2 answers

LZW routine in Haskell using Monads

I'm trying to implement LZW compression in Haskell using Monads, here is my code so far with test cases: {-# LANGUAGE FlexibleInstances #-} {-# LANGUAGE MultiParamTypeClasses #-} {-# LANGUAGE FlexibleContexts #-} import Control.Monad.State import…
user4673049
1
vote
1 answer

LZW Decompress: Why is first dictionary code encountered in TIFF strip 261 instead of 257, or am I misreading it?

I have a trivial RGB file saved as TIFF in Photoshop, 1000 or so pixels wide. The first row consists of 3 pixels all of which are hex 4B red, B0 green, 78 blue, and the rest of the row white. The strip is LZW-encoded and the initial bytes of the…
regger
  • 41
  • 7
1
vote
2 answers

LZW compression on text

How can the LZW output sequence be improved to achieve higher compression? Are there any specific methods? (I am applying LZW compression on a text file)
user4345738
  • 191
  • 9
1
vote
0 answers

use lzw with httpurlconnection in android

we are trying to minimise the json data footprint for our android native application but, from the android developer pages we can see that by default android uses gzip…
Nav
  • 10,304
  • 20
  • 56
  • 83
1
vote
0 answers

LZW Compression/ Expansion in Java

I am trying to use the LZW code provided by Princeton and modify it to vary the size of codeword from 9 to 16 bits. I am unsure of how to do this, but was thinking of maybe using a loop since the size needs to be increased when all codewords of the…
1
vote
1 answer

Need help decompressing GIF raster data

I have a 10x10 gif that consists of 4 colors, white, red, blue, black. I have parsed the gif data below 4749 4638 3961 <-- header 0a00 0a00 9100 00 <-- lsd (pb 91 = 1001 0001) nColors = 4, bytes = 12 ffffff…
bustedware
  • 194
  • 1
  • 3
  • 18
1
vote
1 answer

LZW TIFF decoding

When decoding tiff files with LZW decompression, the first 9 bits in the encoded bitstream should be "256", the clear-code. But when I read it I get a 128, which I just can't figure out. I created the file with GDAL. My code reading the file is: val…
Johan S
  • 3,531
  • 6
  • 35
  • 63
1
vote
2 answers

A Java library to compress (e.g. LZW) a string

Apache Commons Compress works only with archive files (please correct me if I am wrong). I need something like MyDB.put(LibIAmLookingFor.compress("My long string to store")); String getBack = LibIAmLookingFor.decompress(MyDB.get())); And LZW is…
Nerd
  • 321
  • 1
  • 4
  • 9
1
vote
1 answer

How to use gdal_rasterize to create a LZW compressed Tiff

I want to use gdal_rasterize to generate a TIFF from a .shp shapefile. Usually the result is big, so I want to compress it using the LZW compress option. I tried to do so with the command gdal_rasterize.exe -burn 255 -burn 255 -burn 0 -burn 255 -ot…
AdmiralOrange
  • 157
  • 1
  • 14
1
vote
1 answer

letter dictionary for javascript lzw compression, "only-use-these-chars"-string

Good day to all of you readers and helpers, i want to make use of a javascript function i recently found, its LZW compressing a string. function lzw_encode(s) { var dict = {}; var data = (s + "").split(""); var out = []; var…
1
vote
1 answer

LZW Compression with Entire unicode library

I am trying to do this problem: Assume we have an initial alphabet of the entire Unicode character set, instead of just all the possible byte values. Recall that unicode characters are unsigned 2-byte values, so this means that each 2 bytes…
1
vote
1 answer

GIF LZW decompression hints?

I've read through numerous articles on GIF LZW decompression, but I'm still confused as to how it works or how to solve, in terms of coding, the more fiddly bits of coding. As I understand it, when I get to the byte stream in the GIF for the LZW…
user1433767
  • 645
  • 2
  • 6
  • 14
1
vote
2 answers

LZW Compression In Lua

Here is the Pseudocode for Lempel-Ziv-Welch Compression. pattern = get input character while ( not end-of-file ) { K = get input character if ( <> is NOT in the string table ){ output the code for…
Nicholas Rubin
  • 317
  • 1
  • 4
  • 14
1
vote
1 answer

Use Perl to Add GIF Image Other Than 8-bit to PDF

I am attempting to add non-interlaced GIF images other than 8-bit to a PDF document without having to fully decode the bitstream using PDF::Create for Perl. The LZWDecode algorithm that is part of the PDF standard requires all images to have a…
xpsd300
  • 175
  • 2
  • 11
1
vote
1 answer

LZW Compression - A modified version

I have an LZW algorithm - private void start(int maxNumBits) throws IOException{ System.out.println("Beginning"); /** Compress a string to a list of output symbols. */ // Build the dictionary. for (int i = 0; i < 256; i++) …
Sam P
  • 453
  • 6
  • 19