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
4
votes
1 answer

GIF LZW compression in C#

I'm currently working on a self-teaching exercise in programming in C# to make an image decoder, I've produced several working solutions and so I thought I should tackle GIFs before I moved on to the more complex PNG and JPEG formats. My problem is…
user646265
  • 1,011
  • 3
  • 14
  • 32
3
votes
1 answer

LZW bit packing for GIF images in JavaScript

I'm working on a JavaScript application that can generate animated GIF images. GIF images use the LZW compression algorithm, and as such I need to implement it in JavaScript. So far, I've got this code that can compress a string (binary or not) to…
zneak
  • 134,922
  • 42
  • 253
  • 328
3
votes
1 answer

gzip compression on non byte aligned data

Is bit packing detrimental to the performance of gzip? Assume that I have 7 bit values and pack in the following way: Byte1 Byte2 Byte3 Byte4 [aaaaaaab][bbbbbbcc][cccccddd][dddd... As far as I understand LZ compression works on a byte…
3
votes
2 answers

LZW (Limpel-Ziv-Welch) Dictionary coding delimiter issue

This question may not be strictly limited to the LZW algorithm, and may cover other implementations of LZ77 and LZ78: I've been trying to write a compression/decompression utility involving the LZW dictionary coding scheme. The problem is that I've…
Rob
  • 107
  • 1
  • 7
3
votes
2 answers

How do I represent an LZW output in bytes?

I found an implementation of the LZW algorithm and I was wondering how can I represent its output, which is an int list, to a byte array. I had tried with one byte but in case of long inputs the dictionary has more than 256 entries and thus I cannot…
Phate01
  • 2,499
  • 2
  • 30
  • 55
3
votes
3 answers

Wrong ELF class - Python

I'm trying to install this library for LZJB compression. PyLZJB LINK The library is a binding for a C library, the file is located here PyLZJB.so Unfortunately by copying to the site-packages directory when import I get the "Wrong ELF class"…
RadiantHex
  • 24,907
  • 47
  • 148
  • 244
3
votes
1 answer

LZ4 compressed text is larger than uncompressed

I have read that lz4 algorithm is very fast and has pretty good compression. But in my test app compressed text is larger than the source text. What is the problem? srand(time(NULL)); std::string text; for (int i = 0; i < 65535; ++i) …
user2123079
  • 656
  • 8
  • 29
3
votes
0 answers

Decompress LZString in PHP

I used LZString in my JavaScript to compress some JSON data and then post it to my PHP program. (http://pieroxy.net/blog/pages/lz-string/index.html) I have a binary code so I want decompress in PHP, I use LZString.php from this repository :…
MajAfy
  • 3,007
  • 10
  • 47
  • 83
3
votes
2 answers

When does compression increase file size?

I have a large text file which mainly consists of numbers and some delimiters like ,|{}[]: etc. I used Lempel-Ziv encoding for compression. The code I used is not mine and is the one from Rosetta code. I ran the code for line by line compression as…
Animesh Pandey
  • 5,900
  • 13
  • 64
  • 130
3
votes
1 answer

LZW encoding and the GIF file format

I'm trying to understand how to create a .gif file in C++. So far I think I understand everything except how the LZW encoding works. This is the file that I have generated with labels: 47 49 46 38 39 61 -header 0A 00 01 00 91 00 -logical screen…
Display name
  • 721
  • 2
  • 11
  • 29
3
votes
1 answer

Encoding error in GIF LZW compressed stream

I'm writing a C library to export SDL_Surfaces to various formats as an exercise, and so far, I got the BMP, TGA and PCX formats down. Now I'm working on the GIF format and I feel I'm very close to getting it working. My implementation is a modified…
NordCoder
  • 403
  • 1
  • 7
  • 21
2
votes
1 answer

Do i lose quality switching from (JPEGTIFF to LZW) to (JPEGTIFF to JPEG)?

I build an application that handles a lot of scanned images. These images are imported using JPEGTIFF files. I split the TIFF files to single page LZWTIFF files because the application cant handle JPEGTIFF files. The LZW files are a lot larger that…
Ben
  • 23
  • 2
2
votes
1 answer

Counting while compressing in LZW?

Note: This is not the right use for LZW compression. I am just playing around with it. Question In a single pass, is it possible to also update the frequency counts of the elements inside the dictionary? My implementation import sys from collections…
Legend
  • 113,822
  • 119
  • 272
  • 400
2
votes
0 answers

LZ77 and LZ78 differences in dictionaries

you can find in many sources this statement regarding LZ77 and LZ78. They are both theoretically dictionary coders. LZ77 maintains a sliding window during compression. This was equivalent to the explicit dictionary constructed by LZ78 however, they…
malocho
  • 265
  • 3
  • 13
2
votes
4 answers

File compression and codes

I'm implementing a version of lzw. Let's say I start off with 10 bit codes and increase whenever I max out on codes. For example after 1024 codes, I'll need 11 bits to represent 1025. Issue is in expressing the shift. How do I tell decode that I've…
Moose
  • 23
  • 2
1
2
3
12 13