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
39
votes
4 answers

Decompress gzip and zlib string in javascript

I want to get compress layer data from tmx file . Who knows libraries for decompress gzip and zlib string in javascript ? I try zlib but it doesn't work for me . Ex , layer data in tmx file is :
Toan Nguyen
  • 1,043
  • 3
  • 13
  • 24
38
votes
5 answers

Suggested Compression Ratio with H.264?

Note bene: I realize this is an immensely complicated question with about a million levels of nuance that I'm trying to reduce to a single number... I'm about to undertake a large video encoding project using H.264 encoding. We are trying to create…
Nuby
  • 2,378
  • 2
  • 21
  • 26
38
votes
5 answers

Using SharpZipLib to unzip specific files?

I'm trying to use SharpZipLib to pull specified files from a zip archive. All of the examples I've seen always expect that you want to unzip the entire zip, and do something along the lines of: FileStream fileStreamIn = new FileStream…
FlySwat
  • 172,459
  • 74
  • 246
  • 311
38
votes
5 answers

Machine Learning Algorithm for Predicting Order of Events?

Simple machine learning question. Probably numerous ways to solve this: There is an infinite stream of 4 possible events: 'event_1', 'event_2', 'event_4', 'event_4' The events do not come in in completely random order. We will assume that there are…
38
votes
1 answer

How can I extract or uncompress gzip file using php?

function uncompress($srcName, $dstName) { $sfp = gzopen($srcName, "rb"); $fp = fopen($dstName, "w"); while ($string = gzread($sfp, 4096)) { fwrite($fp, $string, strlen($string)); } gzclose($sfp); fclose($fp); } I…
37
votes
4 answers

How to zip a WordprocessingML folder into readable docx

I have been trying to write a simple Markdown -> docx parser/writer, but am completely stuck with the last part, which should be the easiest: i.e. compressing the folder into a .docx that Word, or any other .docx reader, will recognize. My…
Michael
  • 371
  • 1
  • 3
  • 4
37
votes
8 answers

How can I automatically compress and minimize JavaScript files in an ASP.NET MVC app?

So I have an ASP.NET MVC app that references a number of javascript files in various places (in the site master and additional references in several views as well). I'd like to know if there is an automated way for compressing and minimizing such…
wgpubs
  • 8,131
  • 15
  • 62
  • 109
36
votes
3 answers

Compress multiple files individually with Gzip

I have several directories that look like this: dir1/ |_foo.txt |_bar.txt dir2/ |_qux.txt |_bar.txt For each of this directory I want to compress the files inside it into *.gz format then delete the uncompressed ones. So finally we hope to…
neversaint
  • 60,904
  • 137
  • 310
  • 477
36
votes
2 answers

GZipStream And DeflateStream will not decompress all bytes

I was in need of a way to compress images in .net so i looked into using the .net GZipStream class (or DeflateStream). However i found that decompression was not always successful, sometimes the images would decompress fine and other times i would…
Bobby Z
  • 513
  • 1
  • 6
  • 11
36
votes
3 answers

Unable to find type [System.IO.Compression.CompressionLevel]: make sure that the assembly containing this type is loaded

I wrote this PowerShell script to archive all log files created during a certain date range. $currentDate = Get-Date; $currentDate | Get-Member -Membertype Method Add; $daysBefore = -1; $archiveTillDate =…
Maven
  • 14,587
  • 42
  • 113
  • 174
36
votes
4 answers

Python ungzipping stream of bytes?

Here is the situation: I get gzipped xml documents from Amazon S3 import boto from boto.s3.connection import S3Connection from boto.s3.key import Key conn = S3Connection('access Id', 'secret access key') b =…
daydreamer
  • 87,243
  • 191
  • 450
  • 722
36
votes
8 answers

Best compression algorithm for XML?

I barely know a thing about compression, so bear with me (this is probably a stupid and painfully obvious question). So lets say I have an XML file with a few tags. text …
Aethex
  • 1,502
  • 2
  • 16
  • 27
35
votes
5 answers

Write a program that takes text as input and produces a program that reproduces that text

Recently I came across one nice problem, which turned up as simple to understand as hard to find any way to solve. The problem is: Write a program, that reads a text from input and prints some other program on output. If we compile and run the…
Grigor Gevorgyan
  • 6,753
  • 4
  • 35
  • 64
35
votes
7 answers

JavaScript: Decompress / inflate /unzip /ungzip strings

I'm looking for JavaScript implementation of string inflating algorithms. I want to compress on the server side (Java), and decompress on the client side (JavaScript). I've found: unzip strings in javascript That one is marked as answered with an…
Ondra Žižka
  • 43,948
  • 41
  • 217
  • 277
35
votes
4 answers

Can you use gzip over SSL? And Connection: Keep-Alive headers

I'm evaluating the front end performance of a secure (SSL) web app here at work and I'm wondering if it's possible to compress text files (html/css/javascript) over SSL. I've done some googling around but haven't found anything specifically related…
magenta
  • 381
  • 1
  • 4
  • 6