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
172
votes
15 answers

How to compress an image via Javascript in the browser?

TL;DR; Is there a way to compress an image (mostly jpeg, png and gif) directly browser-side, before uploading it ? I'm pretty sure JavaScript can do this, but I can't find a way to achieve it. Here's the full scenario I would like to…
pomeh
  • 4,742
  • 4
  • 23
  • 44
163
votes
6 answers

wbtc.cc.tar.zst

Suppose I have two files: file1.zst file2.tar.zst How can I decompress these files in terminal?
Quarkonia
  • 1,811
  • 2
  • 11
  • 11
152
votes
7 answers

An efficient compression algorithm for short text strings

I'm searching for an algorithm to compress small text strings: 50-1000 bytes (i.e. URLs). Which algorithm works best for this?
Vasily Korolev
  • 1,781
  • 2
  • 11
  • 9
150
votes
10 answers

Excluding directory when creating a .tar.gz file

I have a /public_html/ folder, in that folder there's a /tmp/ folder that has like 70gb of files I don't really need. Now I am trying to create a .tar.gz of /public_html/ excluding /tmp/ This is the command I ran: tar -pczf MyBackup.tar.gz…
suresh
  • 1,503
  • 2
  • 10
  • 4
150
votes
4 answers

Split files using tar, gz, zip, or bzip2

I need to compress a large file of about 17-20 GB. I need to split it into several files of around 1 GB per file. I searched for a solution via Google and found ways using the split and cat commands. But they did not work for large files at all.…
Aka
  • 2,121
  • 4
  • 17
  • 11
148
votes
3 answers

Compress files while reading data from STDIN

Is it possible to compress (create a compressed archive) data while reading from stdin on Linux?
Space
  • 7,049
  • 6
  • 49
  • 68
146
votes
15 answers

How does one make a Zip bomb?

This question about zip bombs naturally led me to the Wikipedia page on the topic. The article mentions an example of a 45.1 kb zip file that decompresses to 1.3 exabytes. What are the principles/techniques that would be used to create such a file…
pufferfish
  • 16,651
  • 15
  • 56
  • 65
138
votes
9 answers

How does Google's Page Speed lossless image compression work?

When you run Google's PageSpeed plugin for Firebug/Firefox on a website it will suggest cases where an image can be losslessly compressed, and provide a link to download this smaller image. For example: Losslessly compressing…
Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
137
votes
13 answers

Gzip versus minify

I had a somewhat lively discussion the other day about minifying Javascript and CSS versus someone who prefers using Gzip. I'll call this person X. X said that Gzip allready minifies the code, since it zips your files. I disagree. Zip is a lossless…
KdgDev
  • 14,299
  • 46
  • 120
  • 156
136
votes
8 answers

How to reduce the image file size using PIL

I am using PIL to resize the images there by converting larger images to smaller ones. Are there any standard ways to reduce the file size of the image without losing the quality too much? Let's say the original size of the image is 100 kB. I want…
Yashwanth Kumar
  • 28,931
  • 15
  • 65
  • 69
122
votes
11 answers

How do you Programmatically Download a Webpage in Java

I would like to be able to fetch a web page's html and save it to a String, so I can do some processing on it. Also, how could I handle various types of compression. How would I go about doing that using Java?
jjnguy
  • 136,852
  • 53
  • 295
  • 323
118
votes
7 answers

How to read data from a zip file without having to unzip the entire file

Is there anyway in .Net (C#) to extract data from a zip file without decompressing the complete file? I possibly want to extract data (file) from the start of a zip file if the compression algorithm compress the file used was in a deterministic…
AwkwardCoder
  • 24,893
  • 27
  • 82
  • 152
118
votes
13 answers

pdftk compression option

I use pdftk to compress a pdf using the following command line pdftk file1.pdf output file2.pdf compress It works as the weight of my file decreased. Are there [options] to change the compression??? Or maybe other solutions to compress my file? It…
RockScience
  • 17,932
  • 26
  • 89
  • 125
117
votes
12 answers

How do I create 7-Zip archives with .NET?

How can I create 7-Zip archives from my C# console application? I need to be able to extract the archives using the regular, widely available 7-Zip program. Here are my results with the examples provided as answers to this question "Shelling out"…
Seibar
  • 68,705
  • 38
  • 88
  • 99
114
votes
4 answers

Fast Concatenation of Multiple GZip Files

I have list of gzip files: file1.gz file2.gz file3.gz Is there a way to concatenate or gzipping these files into one gzip file without having to decompress them? In practice we will use this in a web database (CGI). Where the web will receive a…
neversaint
  • 60,904
  • 137
  • 310
  • 477