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
30
votes
10 answers

Can a JPEG compressed image be rotated without a loss in quality?

JPEG is a lossy compression scheme, so decompression-manipulation-recompression normally reduces the image quality further for each step. Is it possible to rotate a JPEG image without incurring further loss? From what little I know of the JPEG…
Mat
  • 82,161
  • 34
  • 89
  • 109
30
votes
5 answers

how to enable gzip compression in angular cli for production build

I would want to compress the bundle files that are created when building the angular project. I use ng build --environment=${environment} to build the application currently and the version of "@angular/compiler-cli": "^4.0.0" do not generate the .gz…
Cling
  • 489
  • 1
  • 6
  • 15
30
votes
4 answers

How to optimise an Image in React Native

Photos captured via camera are too large for efficient upload and download in React native. Is there an api or library to compress a PNG image file in React Native?
Learner
  • 2,459
  • 4
  • 23
  • 39
30
votes
4 answers

Compress camera image before upload

I am using this code (from www.internetria.com) to take a photo and upload to a server: onCreate: Intent intent = new Intent(MediaStore.ACTION_IMAGE_CAPTURE); Uri output = Uri.fromFile(new File(foto)); intent.putExtra(MediaStore.EXTRA_OUTPUT,…
David
  • 315
  • 1
  • 4
  • 8
30
votes
3 answers

Decompress gzip file to specific directory

What is the gzip equivalent of the following command: tar xvzf /usr/local/file/file/file.tar.gz -C /usr/local/extract_here I am trying gzip -d /usr/local/file/file/file.tar.gz -C /usr/local/extract_here but it does not work, how do I do that with…
gr68
  • 420
  • 1
  • 10
  • 25
29
votes
5 answers

Looking for large text files for testing compression in all sizes

I am looking for large text files for testing the compression and decompression in all sizes from 1kb to 100mb. Can someone please refer me to download it from some link ?
29
votes
6 answers

What are the real-world applications of huffman coding?

I am told that Huffman coding is used as loseless data compression algorithm, but I am also told that real data compress software do not employ Huffman coding, because if the keys are not distributed decentralized enough, the compressed file could…
Jichao
  • 40,341
  • 47
  • 125
  • 198
29
votes
4 answers

Decompress bz2 files

I would like to decompress the files in different directories which are in different routes. And codes as below and the error is invalid data stream. Please help me out. Thank you so much. import sys import os import bz2 from bz2 import…
MY_1129
  • 317
  • 1
  • 4
  • 7
29
votes
11 answers

Latitude/Longitude storage and compression in C

Does anyone know the most efficient representation for lat/long coordinates? Accuracy level should be enough for consumer GPS devices. Most implementations seem to use double for each unit, but I'm suspicious that a float or fixed point format…
Justicle
  • 14,761
  • 17
  • 70
  • 94
29
votes
1 answer

zlib: Differences Between the `deflate` and `compress` Functions

What are the differences between the deflate() and compress() functions in zlib? I have looked through online examples and some used deflate while others used compress. How should I decide which situation I would use one over the other?
mma1480
  • 659
  • 1
  • 9
  • 18
28
votes
1 answer

How to find a good/optimal dictionary for zlib 'setDictionary' when processing a given set of data?

I have a (huge) set of similar data files. The set is constantly growing. The size of a single file is about 10K. Each file must be compressed on its own. The compression is done with the zlib library, which is used by the java.util.zip.Deflater…
Miro
  • 281
  • 1
  • 3
  • 4
28
votes
5 answers

Compressed Json Javascript

Currently I send JSON from an Ajax post to the server which is then converted to objects using the Jackson Mapper. The format is like this {"id":"780710","folderID":"42024","displayOrder":2},{"id":"780724","folderID":"42024","displayOrder":3} What…
rayray
  • 931
  • 2
  • 11
  • 18
27
votes
4 answers

rpmbuild change compression format

I try to pack some map files for our geoserver in an internal rpm package. For the build part, this is just to copy the files. I think this works as expected. But it takes terribly long to pack those 20GB of images. I've read that rpm internally…
mkraemerx
  • 1,713
  • 2
  • 17
  • 21
27
votes
4 answers

Make tar file by Java

I want to use Java to compress a folder to a tar file (in programmatic way). I think there must be an open source or library to do it. However, I cannot find such method. Alternatively, could I make a zip file and rename its extended name as…
卢声远 Shengyuan Lu
  • 31,208
  • 22
  • 85
  • 130
27
votes
7 answers

How to read a .gz file line-by-line in C++?

I have 3 terabyte .gz file and want to read its uncompressed content line-by-line in a C++ program. As the file is quite huge, I want to avoid loading it completely in memory. Can anyone post a simple example of doing it?
Shihab
  • 271
  • 1
  • 3
  • 3