Can I ZIP my pictures or MP3 files to save space?

Most music, picture, and movie files are already compressed. The result is that compressing them again won't make much difference and could even make them larger.

//
Can I ZIP my pictures or MP3 files to save space?

ZIP is a very popular compression algorithm supported by many popular programs such as WinZip, 7-Zip, and recent versions of Microsoft Windows. ZIPping a file or set of files can often reduce their size significantly at the cost of needing to be unzipped before they can be used.

Note though that I said, “…often reduce their size.”

Unfortunately, “often” doesn’t mean “always.”

The short answer

ZIPping photographs, music, and videos will typically not make them significantly smaller and can even make them slightly larger.

To understand why that might be, we need to look into how compression works at a high level.

About compression

While the specifics of many different compression algorithms is often the stuff of research, theses, and even patents, the concepts of compression are actually fairly simple.

The idea is that information stored on disk is often stored in a way that is less than optimal for storage. It may be optimal for other purposes, but as a side effect, there may be redundant information in the data that could be represented differently.

A simple compression algorithm is “run length encoding.”

Consider the following text:

This is a row of 10 asterisks: ********** followed by text.

That’s 59 characters long. If we define the character “+” to not be a plus character, but rather an indicator that the next two characters are a count, and the third character the character that should be repeated that many times, we get this:

This is a row of 10 asterisks: +10* followed by text.

We’ve shortened or “compressed” the text to only 53 characters, but it still means exactly the same thing. When decompressed, the “+” is encountered causing the “10*” that follows it to be read and replaced with 10 asterisks. The original uncompressed text is restored.

This is a row of 10 asterisks: ********** followed by text.

Compression doesn’t always compress

In the example above, we took a line of 59 characters and “compressed” it to 53 characters. It’s not a great compression algorithm, but it worked.

Now, let’s compress this text using the same algorithm:

Here's a single plus sign: + followed by text.

That’s 46 characters long.

The problem is that because it actually contains the plus sign, the character we said was special in our compression algorithm, we can’t just let it be. If we do, the decompression algorithm will look at it and say, “Oh, the next two characters are a count of the number of times I should repeat the third character following,” which is simply wrong.

Unless we specially encode the plus character:

Here's a single plus sign: +01+ followed by text.

That allowed the decompressor to follow its algorithm: “+” means the next three characters are a count (one, in this case) of the number of times to repeat the third character (“+”). The compression and decompression algorithm works.

The only problem is that the “compressed” data at 49 characters is now larger than the original 46.

Every compression algorithm faces this problem. My little example above was crafted to make it easy to show, but even the most advanced compression algorithm will have situations where compressing particular forms of data may cause the “compressed” data to be larger than the original.

Compressing already compressed data

One of the most common ways that compressed data can end up larger than the original is if the original is itself already compressed.

Let’s look at the compressed version of my silly little example again:

This is a row of 10 asterisks: +10* followed by text.

What happens if we try to compress that data again? Well, as we saw, that single “+” sign is a problem and needs to be treated specially:

This is a row of 10 asterisks: +01+10* followed by text.

The result is that the “compressed” data got bigger than the original.

Or rather compressing the already-compressed data made it larger.

This happens most reliably when you compress twice using the same algorithm, but if the compression techniques you’re using are relatively efficient, then the algorithms don’t matter as much. ZIPping something twice makes the second zip larger than the first. But ZIPping a “RAR” file, also a compressed file, will typically result in something bigger than the original.

With that as background, we can finally explain our answer to the question.

Pictures, music, and videos are already compressed


One of the most common ways that compressed data can end up larger than the original is if the original is itself already compressed.
Pictures in popular formats such as .jpg, .png or .gif are already compressed.

Music files in formats like .mp3, .ogg, .aac, and so on are already compressed.

Video files in formats like .wmv, .m4v, .mov, and more are already compressed.

And as we’ve seen by now, depending on the type of compression you’re using, compressing an already-compressed file at best does very little and at worst makes the file bigger.

So there’s typically no space-saving advantage to ZIPping a photo, a movie, or an MP3.

ZIPping is more than compression

Of course, creating a .zip file is useful for more than just compression.

It can be handy to ZIP several files (for example, a collection of several pictures) together, combining them into a single file for a single download, attachment, or file transfer.

People still need to unZIP before they can see them, but it can be simpler to transfer only one file rather than several.

There are 30 comments:

  1. Ronny Reply

    While most picture files do not compress, BMP and RAW files will compress a good deal.

  2. Leo Reply

    Obviously ANY uncompressed format should compress some using ZIP. But it’s not always obvious which files are, or are not compressed. For example some BMP files actually are compressed. Same for some .WAV files.

  3. veronica Reply

    my mp3 player is supposed to hold 4 hours… roughly 60 songs at 4 minutes each, right? but i can only fit around 30 on it, so there’s gotta be a way to basically cut their size in half, but i don’t know how?

  4. Leo Reply

    There are different levels of compression in MP3 that can be traded off against the quality of the sound: the better the quality of sound, the bigger the file. When an MP3 player’s manufacturer indicate how many songs a player might hold, they’ll typically assume better-than-average compression. If you have your own audio software you can adjust the compression if you like, but you’ll probably notice that the quality of sound will degrade.

  5. VINCENT DELLISANTI Reply

    I DOWNLOAD A LOT OF PICTURES FROM INTERNET EXPLORER,CLOSE TO 900.WHEN I OPEN UP MY PICTURES LAST WEEK THEY SHRUNK TO A HALF-INCH.HOW TO I GET THEM BACK TO THE ORINGINAL SIZE? WHAT IS THE URL ABOVE STAND FOR? I AM NEW AT THIS.THANK YOU

  6. Andy McInville Reply

    Is there a way to get the zip music files to burn to a cd to listen to in my stereo?

  7. roy thomas Reply

    Please tell me how to email mp3 or other audio files. I have these audio files (majority in mp3 format) stored in my hard drive and now I need to attach these in my emails? If I attach these audio files, will the receiver be able to listen to these mp3 with good quality? Thanks for your time.
    Roy Abraham

  8. Leo Reply

    Yes, sending them as attachments will not affect the quality, or playability, in any way.

  9. shawn Reply

    hello, how do i send folders of large JPGs from my home computer to my school’s yearbook computer? i’m a photographer for them and i’m worried about compression or any degradation of quality. can i zip them or does that ruin quality? should i just put images onto a CD? thanks

  10. Leo A. Notenboom Reply

    Zipping will not affect quality. It just won’t make them any smaller. Depending on how big things are, you may be better off with a CD, yes.

  11. Tami Reply

    I have been trying to send mp3 files to the guys in my band but they never actually leave my computer. What’s up?

  12. Leo Reply

    Hard to say without more details. It’s possible that your email provider has a limit on how big an email can be, and the mp3′s as attachments excede that size.

  13. Neil Reply

    Hi there, I’m going to be buying a new pc soon, is there any way of putting my mp3 files onto a cd so that i can just burn them onto the new hard drive instead of downloading them all again?

  14. Leo Reply

    If you have a CD burner you can burn them to CD like any other file(s). Perhaps I’m missing the point of your question.

  15. mariam Reply

    how do i save my pictures from my computer to a cd or a dvd? for back up in case comp/crashes or breaks. what do i do zip or what?? thanx.

  16. Nichlaus Reply

    I am a mac user. I send zip files daily to my office with multiple photos. Lately they have been telling me that they can not see all of they files that are in the folder I am sending. It works perfectly to everyone else I send it to except on their computer. Anyone else had this issue?

  17. marc Reply

    just something that might make it easier for all.

    you can creat a self extracting file (EXE, application) for any type of file

    simply hit Start__>run__>type in “iexpress.exe”

    and follow along the instruction from their.

    i think its on most windows machines.

    Marc

  18. billy Reply

    My mp3 player ain’t showing up on ‘my comupter,’
    so i can’t add more music how do you fix it?
    |^_^|?

  19. martina Reply

    How do i send a very large folder of mp3 itunes songs to my friend via email – i cant sit there for hours emailing each track! Ive put all of them into one folder onto my desktop but when i go to open it it asks for a single track to attach rather than the whole folder..

  20. John N. Reply

    Too bad about the .zip method, have 1000′s of mp3s on my hd. taking up too much room.
    Thanks Marc for the IExpress 411. First I’ve seen that, although I’ve seen tools designed to make .exe’s from other formats. And there it is right in windows! I’ll have to try it out sometime (with junk files to start)!

    John N.

  21. bianka Reply

    I wish to send about 30 songs to a friend and I used iexpress and put a whole lot of music in and it worked but when I closed it I cannot see the file and when I open it again and put the name of the file in it says it does not exist and to create a new file – it must be somewhere where do I look? can you help please I am using Vista

  22. Kriss Reply

    i just read all these comments and.. i feel sorry for you XD i cant beleive these people even know how to fill out this forum im typing in…

  23. Jim de Graff Reply

    Zipping files that are already in a compressed format (jpg, for example) may save space, but not due to compression savings. Files are allocated in “chunks”. Any space that is left over in the file’s last chunk is effectively wasted space. The more files, the more wasted space. If you combine all of these files into one archive (zip or otherwise) then you have only the wasted space at the end of the one archive file instead of the waste in each of the component files. However, you have to weigh the space saving against the inconvenience of accessing the files through the archived format. Also, there is a certain amount of space taken up by the zip file header.

  24. Earl Purple Reply

    It SHOULD be possible to compress an mp3 file to a much smaller size (in a lossless format). Yes an mp3 file is “compressed” but for a standard constant bitrate file each second of sound is allocated a fixed number of bytes.

    Most music files will contain repetition, eg a riff or chorus that appears multiple times in the file, and therefore it should be possible, given the right algorithm, to compress out this duplication.

    Why this doesn’t happen in reality I guess is that the standard compression algorithms either do not detect this duplication for whatever reason or simply do not deal with it.

    Maybe someday someone will come up with a totally lossless file compression algorithm for mp3s and even wav, although by then we may all have switched to lossless compression in the first place.

  25. Warren Reply

    @Earl Purple
    Here’s the problem with this theory. Lossless compression works by storing symbols using the least number of bits necessary to represent the original data. To put it another way, the data is represented in the compressed file in a highly complex mathematical algorithm that requires less space than the original data. JPGs, GIFs, MP3s, etc, already store their data in a method extremely similar to this. In fact, it has been shows that the Huffman algorithm used in MP3 is a modified version of LZW, an extremely effecient and highly popular compression method.
    MP3s specifically store music NOT as a compressed waveform, but as a series of coefficients that represent the individual frequencies, or notes, that were present in the original waveform. In theory, the coefficients would take exactly the same amount of data to store, but MP3 “cheats” in that it throws away any of the coefficients that it thinks people would not be able to hear anyway (perceptual modeling). It then compresses the remaining data as much as possible into the Huffman compression format, and then breaks up the data into individual “frames” that can be played back by MP3 players. In order to make the MP3 file smaller, you can throw away more and more of the frequencies, but you WILL start to hear the degradation in quality rather quickly.
    JPGs, and MPGs/AVI/etc, have similar concepts behind them.
    You mentioned that it should be possible to remove the repetition in the riffs, and repeated parts to save more space, but consider this: if you play the same note with an instrument one million times, you will NEVER be able to find two identical waveforms in them! There is far too much randomness to the data for that type of compression to be possible. And it would make no difference if you found two “similar” notes, and somehow subtracted out the differences so you could save the space of the actual second note and just store the tiny differences between the notes. There is so much randomness to the differences that it would take essentially the same amount of space in the file to do that.
    Actually, MIDI does something similar to this, instead of storing the sound from the instruments, it just stores what notes are played and recreates that sound upon playback. It is NEVER going to sound like the “real thing” because you aren’t storing the real waveform, just the information that there was a note played.
    If you would like more info on how compresion works, check out Wikipedia’s article: http://en.wikipedia.org/wiki/Data_compression
    -cheers

  26. bill Reply

    Earl:

    All those riffs that you think could be replaced by one copy, cannot. There are differences in the playing of them every time, even though the sheet music might be the same.
    Consider the Smoke on the Water riff. Even on the sheet music, it has variations, then you add in the ones that come from a real person playing it.

    The problem with your other theory of a loss less way to compress MP3s is that the MP3 has already created losses and if you could find your magical program, you are just copying the losses. However, as Leo tried to explain (and did a much better job than most of the explanations I have seen), a compessed file looks to another compressor as relatively random stuff that doesn’t compress well.
    Don’t ever expect that any program will compress any already compressed (even a lossless) file. FLAC compression is lossless and does a great job in compressing audio files that were not already compressed by something else. You could compress them more by converting them to an MP3 but what that would really be doing is restoring the uncompressed audio and throwing out parts of it that you think are not really noticeable as it compresses it again.

    If you want to experiment with something more obvious than audio (a lot of the changes are very subtle), try using a program where you can convert a photo to jpg and adjust the compression. Pick a photo with some subtle shading of similar colors (like sky) or for a shocker, use some line art (like a screen capture of this page) to see how much the compression looses or modifies the origonal.

  27. John.P Reply

    Life is too short to be using MP3, Memory storage is cheap! Poor quality sound is like drinking cheap wine.

  28. Digital Artist Reply

    The algorithm described in the article is lossless, the ten asterisks are returned intact. Years ago pondering file compression I figured something like that independently. (I have re-invented the wheel hundreds of times, can’t help it) I do a lot of intense graphics work, and I always save my files as bitmaps. (Or vector graphics if they are of that nature) but never as jpg. (Unless I get careless and do it by mistake, which happens sometimes) Disk space is not that precious to me anyway, and a lot of times I will attach a bmp to an email, then wonder if the recipient will wonder why I didn’t send a jpg. If you save a 256 color image as a jpg and then test the count of colors in the picture, it will be in the tens of thousands. If you cut a figure out of the background by filling the backgournd with white, then save the cut out figure as a jpg, and later try to paste that cut out figure over a new background, it won’t work, because the white will have become a hundred or more ‘shades’ of white. I am now curious enough to test a compression program like 7zip on a bmp file, although I doubt I would use it even if it results in high compression and no loss of data. Maybe for archiving some old files to DVDs or something…. Thanks for giving me something to think about. It’s great being a geek in the company of geeks. :)

  29. Mark Jacobs Reply

    @Digital Artist
    .PNG format is a lossless format for saving photos in the same way .FLAC is a lossless format for compressing music. Now that storage and bandwidth are getting cheaper, many websites are using .PNG photos as they have a higher quality. :PNG format is a universal format which is understood by all browsers, image viewes and editors.

  30. Sri Reply

    ZIPping several less used files has a different benefit. It reduces the folder and file names clutter. And reduces the number of file handles (or inodes in Linux). File handles or inodes are the index entries for a file on the file system. And, these are not unlimited. Moreover, it can decrease the computer’s performance/response when searching or using file explorers.

    So, if you have many files that you use rarely, it is good to organize them in folders and ZIP each folder and then delete the files. Also, when you need to store a large number of files on a USB external hard disk, it reduces the backup time. Storing one or few zip files takes substantially lesser time than storing thousands of files.

Leave a reply:

Before commenting please:

  • Read the article. Seriously. You'd be shocked at how many people make comments that prove they didn't.
  • Comment only on the article. If you have a new, unrelated question start with the search box at the top of the page.
  • Don't post personal information. Email addresses, phone numbers and such will be removed.

VERY IMPORTANT: because of a rise an comment spam that's making it through our filters any comments that do not add to the discussion - typically off topic or content-free comments - run a very high risk of being flagged as spam and removed.

If you have a new question unrelated to the article above, ask it on the Ask Leo! ask-a-question page.