Questions tagged [compression]

The name given to the process of encoding data such that it uses lesser number of bits as compared to the original representation.

There are a number of techniques to compress information, with most algorithms working to compress image, speech, music or video. Encoding the same information in lesser bits results in saving some crucial resource such as transmission bandwidth or hard-disk space. Compression algorithms also take advantage of human perception to further reduce the size of information. By encoding the same piece of information with fewer bits in places that the human brain is not accustomed to perceiving as well as other parts, substantial gains in compression ratios can be achieved.

9175 questions
35
votes
8 answers

Create Zip archive from multiple in memory files in C#

Is there a way to create a Zip archive that contains multiple files, when the files are currently in memory? The files I want to save are really just text only and are stored in a string class in my application. But I would like to save multiple…
Adam Haile
  • 30,705
  • 58
  • 191
  • 286
35
votes
3 answers

What is the current state of text-only compression algorithms?

In honor of the Hutter Prize, what are the top algorithms (and a quick description of each) for text compression? Note: The intent of this question is to get a description of compression algorithms, not of compression programs.
Brian R. Bondy
  • 339,232
  • 124
  • 596
  • 636
35
votes
1 answer

Error Deflate And Inflate With zLib

I'm trying to compile the zpipe.c example in my Linux(Ubuntu 8.04) with gcc, but I'm getting some errors, take a look: [ubuntu@eeepc:~/Desktop] gcc zpipe.c /tmp/ccczEQxz.o: In function `def': zpipe.c:(.text+0x65): undefined reference to…
Nathan Campos
  • 28,769
  • 59
  • 194
  • 300
34
votes
5 answers

Most Efficient Multipage RequireJS and Almond setup

I have multiple pages on a site using RequireJS, and most pages have unique functionality. All of them share a host of common modules (jQuery, Backbone, and more); all of them have their own unique modules, as well. I'm wondering what is the best…
davidtheclark
  • 4,666
  • 6
  • 32
  • 42
33
votes
6 answers

Compress large Integers into smallest possible string

I have a bunch of 10 digit integers that I'm passing in a URL. Something like: "4294965286", "2292964213". They will always be positive and always be 10 digits. I'd like to compress those integers into the smallest possible form that can still be…
Paul Lemke
  • 5,494
  • 3
  • 47
  • 66
33
votes
4 answers

What's the most space-efficient way to compress serialized Python data?

From the Python documentation: By default, the pickle data format uses a relatively compact binary representation. If you need optimal size characteristics, you can efficiently compress pickled data. I'm going to be serializing several gigabytes…
Draconis
  • 3,209
  • 1
  • 19
  • 31
33
votes
3 answers

Request content decompression in ASP.Net Core

I sometimes need to post larger JSON request payloads to my ASP.Net Core Controllers. The size of the payload warrants (at least in my opinion) compressing it. Because ASP.Net Core Controllers do not appear to support compressed request content out…
Oliver Weichhold
  • 10,259
  • 5
  • 45
  • 87
33
votes
1 answer

Zip-file that contains nothing but itself?

Just out of curiosity, does there exist a valid zip-file (according to format spec) that, contains nothing but itself? Put another way, does the function implemented by unzip have a fix-point? Can I write a program to search for such a fix-point in…
aioobe
  • 413,195
  • 112
  • 811
  • 826
33
votes
2 answers

How to compress or compact a string in Python

I'm making a python "script" that sends a string to a webservice (in C#). I NEED to compress or compact this string, because the bandwidth and MBs data is LIMITED (yeah, in capitals because it's very limited). I was thinking of converting it into a…
Santiago Mendoza Ramirez
  • 1,497
  • 2
  • 13
  • 26
33
votes
1 answer

Storing compressed json data in local storage

I want to store JSON data in local storage. Sometimes data stored could be more than 5MB(max threshold allowed by browsers for each domain). Is there anyway i can compress or zip the data and store it in local storage ? How much latency it will add…
Rajeev
  • 4,762
  • 8
  • 41
  • 63
33
votes
4 answers

Reduce size of Bitmap to some specified pixel in Android

I would like to reduce My Bitmap image size to maximum of 640px. For example I have Bitmap image of size 1200 x 1200 px .. How can I reduce it to 640px.
Nav Ali
  • 1,232
  • 6
  • 17
  • 26
33
votes
3 answers

Compress file on S3

I have a 17.7GB file on S3. It was generated as the output of a Hive query, and it isn't compressed. I know that by compressing it, it'll be about 2.2GB (gzip). How can I download this file locally as quickly as possible when transfer is the…
Matt Joiner
  • 112,946
  • 110
  • 377
  • 526
33
votes
7 answers

Python - mechanism to identify compressed file type and uncompress

A compressed file can be classified into below logical groups a. The operating system which you are working on (*ix, Win) etc. b. Different types of compression algorithm (i.e .zip,.Z,.bz2,.rar,.gzip). Atleast from a standard list of mostly used…
kumar_m_kiran
  • 3,982
  • 4
  • 47
  • 72
32
votes
6 answers

How can I enable keep-alive?

I ran a Google Page Speed and it says I scored 57/100 because I need to "Enable Keep-Alive" and "Enable Compression". I did some Google searches but I can't find anything. I even contacted my domain provider and asked them to turn it on, but they…
John Doe
  • 3,559
  • 15
  • 62
  • 111
32
votes
15 answers

How can I determine the length (i.e. duration) of a .wav file in C#?

In the uncompressed situation I know I need to read the wav header, pull out the number of channels, bits, and sample rate and work it out from there: (channels) * (bits) * (samples/s) * (seconds) = (filesize) Is there a simpler way - a free…
John Sibly
  • 22,782
  • 7
  • 63
  • 80