Click here to Skip to main content
15,880,905 members
Everything / General Programming / Compression

Compression

compression

Great Reads

by Patrice T
RLE (Run Length Encoding): The Human Friendly Compression
by Michael Haephrati
The MakeCab tool is built-in in Windows but using it to create a .cab archive is a bit tricky. Why not write a small program that will do that for you?
by Jovan Popovic(MSFT)
In this article, you will see how to compress data in SQL Server using GZip algorithm and send it via node.js to browser.
by Serge Berlin
.NET Library for in-memory GZip and LZMA compression combined with strong BlakeB based stream cipher engine

Latest Articles

by Jeffrey T. Fritz
Azure Storage Caching and Compression
by Patrice T
RLE (Run Length Encoding): The Human Friendly Compression
by RegularJoe5150
A reformulation of compressed pair into a type list
by Serge Berlin
.NET Library for in-memory GZip and LZMA compression combined with strong BlakeB based stream cipher engine

All Articles

Sort by Score

Compression 

16 Apr 2022 by Patrice T
RLE (Run Length Encoding): The Human Friendly Compression
24 Aug 2018 by Michael Haephrati
The MakeCab tool is built-in in Windows but using it to create a .cab archive is a bit tricky. Why not write a small program that will do that for you?
17 Aug 2015 by Dave Kreskowiak
Possible, yes, BUT... It depends entirely on what's in the files and the compression algorithm used. If they're nothing but text files, you might be able to get 90% out of it. If it's a bunch of JPG files, not a chance. The files are already compressed about as much as is going to be possible.
13 Jun 2019 by OriginalGriff
That's not the compression, that's Base64. Base64 takes a string of byte values (which can hold 256 different values) and converts it to a "text friendly" version that can be transfered via text-only protocols like JSON, XML, and HTML. It does that by storing 6 bits of the first byte in the...
11 May 2012 by CPallini
Given a set of suitable input data, there are essentially these paramenters: the compression ratio (size_after_compression/size_before_compression) and both the compression and decompression speed (bytes/sec).
19 Mar 2013 by Zoltán Zörgő
If you want to send images over network and you don't want TCP because of it's overhead or other limitations, you can use of course UDP. But: UDP is not reliable, and as you noticed, you might encounter several problems if you want to send large files (that need to remain consistent)....
7 Nov 2013 by sudeep23
I want to download a folder by compressing it to .tar extension.I have use the ICSharpCode.SharpZipLib.Tar to compress. But it is not working. My code is below.Please help me out..ASAPprivate void CreateTar(string outputTarFilename, string sourceDirectory) { ...
7 Nov 2013 by Mehdi Gholam
Start here : https://github.com/icsharpcode/SharpZipLib/wiki/GZip-and-Tar-Samples#wiki-createTGZ[^]
4 Dec 2014 by Mehdi Gholam
Read the documentation here : http://nodejs.org/api/zlib.html[^]
11 Dec 2015 by Jovan Popovic(MSFT)
In this article, you will see how to compress data in SQL Server using GZip algorithm and send it via node.js to browser.
4 Jan 2016 by KarstenK
if you are REALLY SURE, that it will only be decimal numbers you can go as easy as this: char digit1 = sample[i]; int value1 = digit1 - '0'; //is between 0 and 9 char digit0 = sample[i+1]; int value0 = digit0 - '0'; //is between 0 and 9 int number = value1 * 10 + value0; ...
31 May 2016 by OriginalGriff
Use SQL to do it: DECOMPRESS (Transact-SQL)[^] - since it compressed it, the safest way to decompress it is to get it to do it...
1 Jan 2019 by Serge Berlin
.NET Library for in-memory GZip and LZMA compression combined with strong BlakeB based stream cipher engine
2 Jan 2023 by Jeffrey T. Fritz
Azure Storage Caching and Compression
11 May 2012 by Bernhard Hiller
When it comes to loss-less compression (i.e. compressing a file for storage), then the main point is compressed file size divided by original file size, followed by the time required for compression.Sometimes, a lossy compression is used, e.g. jpg for images, or mp3 for audio. Here, a...
13 Jun 2019 by MAU787
hi all i have one function which generates string that string is very lengthy. i want to decrease its length and size this is my code and result: not posting real string it is very long protected void Page_Load(object sender, EventArgs e) { string txt = "somestring"; ...
26 Sep 2012 by senguptaamlan
Hi Guys,I'm facing the following problem while compressing and decompressing a string. To make it understand better, I'm including the code in step by step manner.1. I've a JSON string something like the following one[{"FirstName":"First Name 0","LastName":"Last Name...
26 Sep 2012 by RKnGl
Documentation says ...My decompressed files are invalid whats wrong?When reading from streams you should keep reading until the end of the stream has been reached. Do not assume that because you provide a buffer big enough that it will be filled in a single read. When a read returns 0...
1 Feb 2013 by LEADTOOLS Support
Multi-Platform OCR with LEADTOOLS 18.
17 Feb 2013 by Daveedu
Below code is not working to re-generate my compressed video. Could you please any one help me on this ?atform, i am struggling to resolve this problem. Could you please any one help me on this.?public class CompressionTest{ public static void main(String[] args) { ...
17 Feb 2013 by Mehdi Gholam
Deflater and Inflater are presumably for zip file handling and not for video usage. Try finding a library for video handling instead.
18 Feb 2013 by H.Brydon
Be aware that characters (not bytes) in java are wide characters - each character is 16 bits wide. A byte is 8 bits. In almost every other language, a character defaults to 8 bit form.
15 Mar 2013 by Sergey Alexandrovich Kryukov
You will find all you need here: http://en.wikipedia.org/wiki/Huffman_coding[^].See also the referenced to examples in this article.Now, the question is not quite correct: the algorithm is abstracted from the content you want to compress. But it makes some sense, because a linked list is...
19 Mar 2013 by Dave Kreskowiak
You can turn a bitmap into an array of bytes with this: ' You can use your own bitmap object. This one is just for illustration. Dim myBitmap As New Bitmap(1280, 1024, PixelFormat.Format32bppArgb) ' Create a Rectangle object the size of the entire bitmap. ...
21 Mar 2013 by Saurabh.Garg
I used this one for my C++ projects:Zip Utils - clean, elegant, simple, C++/Win32[^]-Saurabh
12 Apr 2013 by shahcool143
Hello Sir/Madem,I want to GZip Compression in Asp.net for css/js files.how to apply GZIP compression for it.is Gzip compress confilct with ajax component ??
12 Apr 2013 by Abhinav S
You can use the GZipStream class[^].Examples -http://www.dotnetperls.com/gzipstream[^]GZipStream - Compress/Decompress a string[^]
27 May 2013 by khurram_shahzad
Hi Everyone,I'm facing some issue in configuring compression on tomcat7, scenario is that i'm working on client site where i've to turn on the compression on server on tomcat7. so what i've found the way to do this is to modify ...\tomcat7.0\conf\server.xml file and add some line to enable the...
28 May 2013 by khurram_shahzad
i Found the point that stopping compression when im accessing application from users PC (not from inside the application server). the issue was that browser has proxy configured so tomcat compression was not working through proxy.i found this by testing the compression directly on server and...
17 Jun 2013 by David Alejandro Garcia Garcia
Hello, i have a big application, i launch my app from the web using a jnlp file, and pack200 to compress it, and download faster. But since my app is getting bigger (about 35-45mb), some times pack200 just hang out, or some times, the jnlp downloader hang out, is there an alternative better to...
21 Jun 2013 by Terry Neckar
I have a file that is used by an archived program that the source no longer exists. I'm working on expanding the function of that program but in doing so have many files that I need to know their format. I have one that is compressed but I can't find any compression formats that fit it. If...
4 Sep 2013 by mccaber82
I am using the Kinect SDK to capture an RGB stream. I am capturing the data at: ColorImageFormat.RawBayerResolution640x480Fps30More info on available formats here. I want to store this stream on disk, so I am using a binary writer to write the raw frame bytes of the color image. This...
10 Jun 2020 by Member 10610788
Im having trouble coming up with a way too decompress a string in java, this is a basic java class im taking so it only requires basic commands, nothing too fancy. The objective it to able to type C:\>java Compress -c aaaabbbbbcc in the command prompt and it will print a4b5c2 (like it is...
28 May 2014 by ravikhoda
Hi all,i am generating a zip file using sharp zip lib in c# window application. this zip file is password protected. now i want to unzip this file using the mini zip library on ios7 but when i try to extract it using the password it show bad or corrupted file in the ios. however if i...
28 May 2014 by Rob Philpott
This *could* be to do with 64 bit extensions. If it works without password protection then this isn't the problem.It is however a common problem that if you use the latest version of SharpZipLib, Windows XP can't understand the format and claims the file is corrupt. Afraid I don't know...
9 Jul 2014 by Anton Koekemoer
I will not give you the code, but will try to guide you in the right direction.This seems to be a simple RLE type compression, so decompression is very simple.You need to understand what the compress method does, once you do this, the decompress should be obvious.The compress will scan...
23 Oct 2014 by Rasik Banta
I am writing a client to consume an asmx web service which has gzip encoding enabled. I am trying to view the response in Fiddler.The strange thing is that it doesn't work in my server but works in another server which is in a different network.I have googled but couldn't find any...
28 Nov 2014 by Sergey Alexandrovich Kryukov
This is not a correctly posed question. More exactly, there is no a problem with that.Compression has nothing to do with languages. However, compression ratio does depend on the content of the data. You can only compare blocks of data of the same size in bytes. If you compress the block, the...
25 Feb 2015 by Sergey Alexandrovich Kryukov
You can use famous open-source 7-zip which implements different algorithms, including ZIP:http://en.wikipedia.org/wiki/7-Zip[^],http://www.7-zip.org/[^],http://sourceforge.net/projects/sevenzip[^],http://sourceforge.net/projects/sevenzip/files[^].—SA
15 Mar 2015 by manchanx
1) replace your if-else-cascade in void fa_z(FILE *fp) with a switch-statement.2) replace the switch-statement in void fa_z(FILE *fp) with an array or dictionary* and no case-distinction at all.3) sort the result of void fa_z(FILE *fp) by frequency.4) build a huffman-tree from the...
15 Mar 2015 by George Jonsson
You can start with replacing the while loop in void fa_z(FILE *fp) withint index = 0;while ((c = fgetc(fp)) != EOF){ if (c >= 'a' && c
20 Jul 2015 by Sergey Alexandrovich Kryukov
You can find an answer here: http://stackoverflow.com/questions/18079754/convert-and-display-image-from-byte-array[^].—SA
31 Dec 2015 by bling
Abstraction.You need an abstraction layer between the code and the actual data (file or memory). You'll need to write two implementations of this abstraction layer - one for a file and the other for memory. Your comments state the need for random access so this layer will need to support...
5 Jan 2016 by Member 12223678
unsigned int i; const char *s = "123465789"; vector num; for (i=0;i
9 Jan 2016 by OriginalGriff
I assume you are talking about this article: LZW Compression Algorithm Implemented in Java[^] - if so, the original author does not appear to be active anymore, and since teh articel was written in 2006...You could try this: LZW data compression-decompression algorithm java code Java[^]...
9 Apr 2016 by Prakash1206
there are a lot of questions asked regarding opencv + H.264 but none of them gave detailed explanation.i am using openh264(openh264-1.4.0-win32msvc.dll) along with opencv 3.1(custom build with cmake having ffmpeg enabled) in visual studio, i wanted to save video coming from webcam in mp4...
11 Apr 2016 by OriginalGriff
That code doesn't compress anything!Partly because it writes the input data to the output stream instead of the byteOut data, and partly because even if it did, byteOut contains the same data as byteArray anyway...If you want to compress data in C#, then look at the GZipStream Class...
18 Apr 2016 by TaruMeenal
Found one app :Ivideon.Its similar to what my requirement is.
20 Apr 2016 by Tomas Takac
This is not the right forum, please ask here:Compressed Sensing Intro & Tutorial w/ Matlab - Add a Comment or Question[^]
2 Aug 2016 by CPallini
Suggested reading: Run-length encoding - Wikipedia, the free encyclopedia[^].
26 Mar 2017 by Member 11405465
I'm working on an application which transfers huge data from server (Web API) to client (JavaScript) which takes some time over the network. So we decided to go with compression in server and decompression in client. I have used Zlib for .NET to compress my file. Below is the code which I have...
23 Jul 2017 by Member 13324712
hi did you resolved above issue ?
18 Dec 2017 by Patrice T
Quote: anyone can help please? No, nobody can help you in such a forum. The reason why everyone do not have its own video converter is because it is complicated and well above the level of beginners. Each of these topics are worth books: LZW compression, video file formats, mp4 file format and...
9 Feb 2018 by RickZeeland
Maybe Kalman filtering might be of interest to you: Kalman filtering demo[^]
13 Feb 2018 by RickZeeland
Found this at: How do I reduce the number of data points in a series? - Cross Validated[^] Quote: calculate the distance between two points with a formula like d=sqrt((time1-time2)^2 + (bpm1-bpm2)). You set a minimum distance in your program. Then you iterate through your data and after every...
30 Apr 2018 by Member 13803981
This is what manual says: Syntax:   outsize = Huffman_Compress(in,out,insize)   outsize Size of output buffer after compression in Pointer to the input buffer (uncompressed data) out Pointer to the output buffer (compressed data) insize Size of input buffer The output buffer must be able to...
30 Apr 2018 by Rick York
The function takes a pointer to the input buffer so you have to provide that. So, given the name of a file and the fact that you have to provide a buffer of data, the next step would be to read the file into a buffer of data. What I would do is determine how big the file is, allocate a memory...
8 May 2018 by MacOwl
I have an old application that stored images (scanned B&W pages) in a large binary file. I have worked out how to single out the individual pages, but I can't decipher the binary for each page. As far as I know, the original pages were TIFF images. The resulting binary is also 1/16th the size,...
24 May 2018 by Mehdi Gholam
As a general rule, don't believe all you see on TV, most of what is shown is exaggerated for dramatic purposes and not correct. Like Richard Deeming commented, compression uses the information content or entropy (the degree of randomness) of the data input to create an output with the maximum...
24 May 2018 by CPallini
Generally speaking the answer is no, you can't. However, in particular cases you might achieve even higher compression ratios. Please note video compression is lossy most of the time.,
24 May 2018 by Patrice T
Quote: Is it possible to create software like Pied Piper from HBO's Silicon Valley? Short reasonable answer: No, it is fictional. Read this: Is the compression algorithm shown in Silicon Valley possible in reality? - Quora[^] In theory, an incredible breakthrough is always possible but very...
20 Aug 2018 by Member 13955667
I'm trying to find an image compression algorithm in the Swift programming language, as in the WhatsApp messenger. In the programming language Java under OS Android I found quickly, and under the platform iOS have difficulties. Here is the image compression algorithm for Android: public...
20 Aug 2018 by Patrice T
Quote: This algorithm compresses the image to 100 KB. No, this code do not compress the image to given size, it downscale the image. The reduced size is only a secondary effect. Quote: I'm trying to find an image compression algorithm You are not looking for a compression algorithm jpeg images...
5 Nov 2018 by nairnishitha
We are logging custom events from application to ETW. Now need to find the best compression technique as lots of data will be written to the file and the etl file is to be send with error report to the server. How to specify the details? In System.Diagnostics.Tracing.EventSource itself, when...
5 Nov 2018 by johannesnestler
Depend's how you use it, but Maybe this helps: ETW Trace Compression (and xperf syntax refresher) | Random ASCII[^]
11 Jun 2021 by RickZeeland
See: How To Hide Files In a JPG Picture[^]
6 Jan 2023 by Lones
Hello everyone, Im trying to create my own data compressor and decompressor I saw some posts here and I tried to change them but there is a problem. Let's say I created a file trial.txt program compressing it but adding a lot of 00 00 00 00...
22 Dec 2021 by k5054
Look at this: int count; /* assign a value to count */ char Message[count]; /* creates a buffer of size count */ /* ... a bit later */ unsigned CompressedSize = sizeof(Message)*7/8; Creating an array on the stack with a size determined at...
11 Jan 2016 by Milliarde
Get started understanding compressed sensing (CS) with some simple code-based examples!
27 Jul 2015 by OriginalGriff
Oh, boy...This is a complicated subject: far, far beyond what we can discuss in a little text box.So start here: https://en.wikipedia.org/wiki/Data_compression[^]Then begin reading some of these: Google[^]We can answer specific questions - but we can't explain a huge subject like...
27 Jul 2015 by Sergey Alexandrovich Kryukov
It on the algorithm and the data to be compressed as well, especially in case of lossy compression. The use of "frequent values" is just the technique used only in some, often most primitive algorithms, such as run-length encoding (https://en.wikipedia.org/wiki/Run-length_encoding[^]). The...
27 Feb 2016 by Arvind Gehlot
Use of HTTP Compression on ASP.NET / MVC pages using IIS or Server side code
19 Feb 2013 by Sergey Alexandrovich Kryukov
JAR file is actually ZIP. If your question is just about compressing, you can use one of the two open-source solutions:You can use #ziplib:http://www.icsharpcode.net/opensource/sharpziplib/[^].Another option is using SevenZipSharp, a .NET wrapper of the famous...
28 Aug 2021 by RegularJoe5150
A reformulation of compressed pair into a type list
5 Dec 2013 by Tharaka MTR
How to automate PNG and JPG image optimization
19 Mar 2013 by Dave Kreskowiak
Why are you converting an image to Base64 in the first place?? Surely it can't be to think you'll get less data to send?? You're actually making MORE data to send, not less by doing this conversion. A screenshot at 1280x1024 results in just over 5.12MB of data. The Base64 string of this data...
4 Sep 2013 by mccaber82
I have an image coming from a web cam. Its coming in at 640px width, 480px height, format of PixelFormats.Brg32.I am writing the image to disk as the frames arrive but unfortunately its far to large (I use binaryWriter to do this). To save on space, I've decided to use compression to...
17 Dec 2014 by Brad Joss
SQL CLR Functions for Zip Compression and Regular Expression evaluations
7 Jul 2015 by Ordiales
If a Zip file has his origin in Linux or Mac. ZipArchive class can fail trying to return Entries Collection
21 Mar 2013 by Matthew Faithfull
There are two things here, working with data compression and working with C++. To crack data compression you'll nee to understand the mathematics and algorithms at least reasonably well from a theoretical point of view, in other words on paper. A quick search tells me I might start somewhere...
18 May 2013 by Abhishek Kumar Goswami
This tip compares GZIP compression facility provided by Java and .NET.
19 Feb 2013 by Menno van Leeuwen
I solved the question after a bit of help from Sergey Alexandrovich Kryukov.He said that JAR Files are the same as ZIP so I used this code to extract my JAR.Dim cur As String = (Environment.CurrentDirectory) Dim MC_JAR As String = install_path.Text & "\bin\minecraft.jar" ...
28 May 2013 by CHill60
First thing to check ... So you've installed tomcat on your local machine ... have you installed it on the client machine? Make sure that it's on there - enabling the compression and installing the tomcat server are not the same thing.If you still have issues then post a question to the...
15 Mar 2013 by shobhitbhalla
hi can anybody tell me how to compress a link list data in c language through huffman encodng technique ?
20 Jun 2013 by AlphaDeltaTheta
Pack200 and "deflate" are the only ones that are supported in java out-of-the-box. Though you can write a Classloader that reads from other archive format such as BZip2 or 7z (LZMA), it requires to be present in a start-up stub applet, that contains the Classloader, downloads the archive...
25 Feb 2015 by phil.o
Your question seems a little weird. You are talking about Kraft inequality, Shannon & Huffman codes, so you seem to already have some knowledge in algorithmics in general, and in compression algorithms specifically. So why don't you just try?My only source when it comes to dealing with .zip...
2 Aug 2012 by _Amy
Hi,You are converting your string to byte and again displaying it in string format?The string representation of byte will be big in length and size anyway. Store it in byte only.--Amit
18 Mar 2013 by Prasad Khandekar
Hello,How about using System.IO.Compression.GZipStream class. The example of using this class can be found here[^] in MSDN library. There is one more example available here[^].Regards,
25 Apr 2020 by Member 12223678
hello everyone I've been trying to come up with a way to condense (compress) a large string that only contains numberis it possible to combining each couple of numbers and represent them in 8 bits instead of having each character take up the entire octet Here is my input...
11 May 2012 by PKriyshnA
please give me some parameter which is used to evaluate the performance of compression algorithmtell me how it is used to valuate...please helpthanks
27 Jul 2015 by BijoyJoseph
There are many compression algorithms available and in general these algorithms take the frequent values from a file which has to be compressed and keeps a count of it. Okay, so what are these values exactly? are these the bytes (I think most files are represented in Hexadecimal form for ease of...
2 Oct 2015 by anil_kumar_bhakta
Dear All,I am going to plan for backup tool. I have tested some of the built-in libraries like from SharpZip,DotNetZip etc. But i observed that DotNetZip has limitation of 4GB filesize. Our requirement is to compress files & folders which are more than 100GB in size.Another experiment...
18 Apr 2016 by TaruMeenal
Is there any open source Video Compressing app or software which compress the Video and save it to any storage like cloud parallelly while taking that video from a Phone or Tab cameraWhat I have tried:I have Tried Some Spy Apps Like Mobile Hidden Camera ,Spy camera OS, But some are not...
21 Mar 2013 by Alamgirable
Where is the best place to start working with data compression in c++.I want to compress data ontwo endpoints on one endpoint i want to compress data and on other i want decompress.Please help me.
15 Mar 2015 by Member 11410794
data compression pro#include#include#include#includevoid fsize(FILE *fp);void fcal(FILE *fp);void fa_z(FILE *fp);char r;long char c;void main(){ FILE *fp; clrscr(); fp=fopen("file name.txt","r"); ...
26 Dec 2015 by Member 11869825
Dear friends, I am trying to implement a program that reconstructs a binary file, starting from the old file and a file of differences. The work is based on the ingenious thesis Olin Percival, Naive differences of executable code, http://www.daemonology.net/bsdiff/ , 2003. I want to use the...
19 Feb 2013 by Menno van Leeuwen
Hello I got a short questionHow do I extract a JAR file with visual basic 2010And how do I compress one?
18 Mar 2013 by Rixterz123
Hey againI have made a program that turns an image into a base64 string and sends via UDP.the problem is that i get an error when the base64 is too largeHow do you compress this on the host side and then decompress back into a base64 string on the client side?Help is appreciated.
28 Nov 2014 by Member 11199376
hey all i have a problem with my graduation projectits arabic language compression/decompressioni have done some compression algorithm i found it up here which output's a binary array to the compressed text , i've been thinking can i use lzw binary compression to maximize my output...
4 Dec 2014 by Joseph Regis
Hi, We are receiving a compressed binary from service which i need to decompress to "utf8 string" using gzip or any other format in node.js. How we can do this?. Note that compression happened using zlib. Thanks in advance.