Can I ZIP Photos or MP3 Files to Save Space?
Hi, everyone. Leo Notenboom here for askleo.com.
Ask Leo is supported in part by my patrons.
I'm eternally grateful to them for their
support and invite you to come along for the ride.
askleo.com/Patron has information about how you
can help and the patron exclusive benefits you get when you do. Question.
"Can I zip my photos or MP three files to save disk space?"
You can zip them, but you're not going to save a lot of space.
In fact, it is possible that zipping these files could make them bigger.
In order to understand why that might be, we actually need to dip our toes into just
what it means to compress something and how it works.
Fortunately, this is where I happen to have a couple of patents.
So
the short answer, of course, is that Zipping really doesn't help make
things smaller if they're already compressed.
Zip files are compressed.
Mp, three files are compressed, and of course JPEGs are compressed.
Pngs are compressed.
Many of these
file formats that we've become used to containing lots and lots of data
have over time evolved to actually be compressed file formats themselves.
A great example is the document format used by Microsoft Office,
and by that I mean both Word and Excel and PowerPoint, and probably some others.
One of the things that they changed some versions ago was you may remember,
there used to be .Doc files, and now there are .Docx files.
As one example, what .docx files are
are Zip files that happen to contain the information about your document.
If you don't believe me, grab one,
rename it to be a zip file instead of a Doc file, and then use your favorite
Zipping program to take a look at the contents.
You'll find some interesting stuff.
There usually XML documents, all sorts of interesting information about
what your document actually contains. But that's what they did.
In one of the ways to keep their documents from growing excessively large was to use
a Zip algorithm on the documents themselves.
And given the kind of information
that they end up taking, the Zip algorithm,
compression actually becomes fairly effective on documents depends a lot
on the contents of your pictures and your music and your videos.
To understand just how effective it's going to be there.
But those compression algorithms that are
used by those other file formats are, of course, immediately tailored
to the specific nuances of what's going to make music smaller.
What's going to make video smaller?
What's going to make images smaller
with or without losing inequality along the way?
So let's talk at a very, very high level.
First about just what it means to compress something.
Now, in the article on which this video is based, I've got some examples.
One of them is this let's take a look at a string of text quote,
this is a row of ten asterisks with ten asterisks followed by text.
One of the ways that that text can be
compressed is to replace those ten asterisks with something smaller
that means ten asterisks.
an example, might be a plus sign.
To say what follows is compressed a ten to indicate that there's ten of something,
and then an asterisk meaning that there's supposed to be ten
asterisks in this spot, the net result four characters long is
shorter than the ten characters it replaces, and therefore we can say
that that text has been shortened or compressed.
When you decompress it, it comes back to the original.
This is a row of ten asterisks followed by some text.
Now, the question, of course,
is what might cause it to grow in this specific compression example.
It is definitely not an efficient
compression algorithm at all is just an example.
What happens if we run across a plus sign?
We've designated that a plus sign means what follows is compressed.
But what if you really want a plus sign and it's not to be some compressed string?
Well, you have to do something now.
There are a couple of things you can do
using the exact same algorithm that we've used so far.
We can say that plus followed by a number one followed by a plus would be one way to
make sure that the plus sign can be encoded but still remain only a plus sign
without breaking a decompression algorithm.
The problem we just made it longer.
We just took that single plus sign that was in our original text to be
compressed and turned it into four characters.
The result of our algorithm actually made
the compressed string bigger than the original.
Now, the problem, of course, is that this happens.
My example is manufactured, it's made up. I get that.
But every compression algorithm runs into this problem.
There are cases where compressing the data will make the result larger, not smaller.
The most common case the most obvious case is when you're compressing already
compressed data at a really high kind of theoretical level.
What compression does is it removes redundant information.
It removes information that in the long run isn't necessary to completely
represent the information that's being contained.
It can be reconstructed somehow.
But if you've already removed redundant data and there's nothing left to remove,
then running a compression algorithm on it has to somehow at least say this
Information's been compressed and then do something with the data.
In every single compression algorithm, there are cases where compressing
compressed data will make the result larger.
Now, like I said, pictures in JPEG, PNG or GIF format are already
compressed video files in WMV, MP4 MOV, and more.
They're already compressed. Audio files like MP3, already compressed,
even some document files like I mentioned before, .Docx, Xlsx, etc.
They're already compressed.
They've already had a zip algorithm run across them.
So if you now take those documents and try to compress them again.
There's a chance they're going to get a little bit bigger now.
It may still get smaller, not a lot, but it may still get smaller.
And that has to do with differences in compression algorithms.
For example, we know that .Docx files are compressed using Zip compression.
If you were to then use a different
compression algorithm, maybe RAR, or something else,
you might get it actually to be a little bit smaller, you might get lucky.
You might not. It might still get bigger.
If you zip a Zip file, it's going to get bigger.
But if you RAR a Zip file, you could get lucky. With movies
M4 specifically, or Audio MP3, those algorithms are compression
algorithms designed specifically for that kind of data.
Zipping it,
which is a different algorithm, may or may not actually make things
a little bit smaller or a little bit bigger.
There's just no way to tell.
The only thing we can be pretty certain
of is it's not going to make a whole lot of difference.
There's one last thing I want to talk about, and that is the fact that Zip
specifically is more than a compression algorithm.
It's an archiving tool. By that.
I mean, rather than just compressing a file and having a file be a result.
Zip specifically allows you to accumulate
a number of files together into a single Zip archive.
While the individual files may or may not
get smaller. The collection will almost certainly be depending on
if you have a lot of files, will almost
certainly be smaller than all those individual files on disk.
That has to do with the way that files are stored on disk.
Remember, a one Byte file actually takes up probably 512 bytes or 1024 bytes or
2048 bytes, depending on the format of your hard disk.
But you can see that with that small file,
there's a lot of redundancy, a lot of leftover, a lot of wasted disk space.
But it's true for every file,
every file always takes up a certain amount of space that is rounded up
to what's called the cluster size of that hard disk format.
When you take those files and smush them
all together into a Zip file, all that wastage goes away.
You're still compressing or not the file as they come into the Zip file.
But you're then creating a single file that doesn't have that same number
of rounding errors, if you will, as it gets stored on the hard disk.
But that's less obvious and sometimes
a less important result of Zipping files together.
Honestly, when we're Zipping files together, it is generally more
of a convenience than it is a compression approach.
What we're trying to do is pull a bunch
of files together so that we can have one file that represents them all so that we
can give that single file to someone else so that we can upload that single file
somewhere, or we can download that single file and expand it into all of the files,
the individual files that it contained.
Compression is part of the issue.
But it's not the reason, necessarily that we're zipping it.
But the bottom line here is that no, you cannot expect a zip of your zip files
or your pictures or your videos or your music files to get smaller.
That's just not the way compression works.
Sorry. For updates for the original article on which this video is based.
For related links, comments and more, visit askleo.com/10176.
Leo Notenboom. This is askleo.com