0

I had 100 images from a Raspberry Pi project and in order to transfer them to another computer, I used the "Compress" interaction after selecting all of the images and using the right click context menu. The resulting file (.gz) has the correct size, but there is only one image inside (and of correct size), which even after extraction with multiple tools (GUI, 7z, unzip etc) is shown to be a single image of ~300 Mb (which I can open and display).

What is happening here?

An image which shows the conflicting results I get from the GUI and command line

5
  • There will be one .gz per file. Some won't have compressed because they'll have got larger
    – roaima
    Jan 7 at 17:56
  • I have checked and this is not the case. If I compress it the same way using tar.gz the functionality is as expected.
    – mannaroth
    Jan 7 at 18:29
  • Your expectation is wrong, I'm afraid to say. Compressing to .gz is a 1:1 operation. If you want the equivalent of zip you will need to create a tar file and then compress that. Let me also change my first comment to read, "there should be one .gz per file, but it looks like your .gz is a useless concatentation of all the files"
    – roaima
    Jan 7 at 18:33
  • I didn't want any compression, it's already a bunch of jpeg files, I just wanted a way to transfer all the files at once. How do I de-concatenate the files is the question?
    – mannaroth
    Jan 7 at 19:00
  • Ok, so reading further about the purpose of the .gz format: "The .gz file was produced by gzip, which is a compression tool. It does not archive multiple files together. It compresses single files." Now I understand the problem, thank you! I misused the format, I thought that .gz and tar.gz are just different compression algorithms.
    – mannaroth
    Jan 7 at 19:05
1

The problem arises from the misuse of the file format, which is not intended for multiple files, as roaima clarified. The gzip manpage states:

If you wish to create a single archive file with multiple members so that members can later be extracted independently, use an archiver such as tar or zip. GNU tar supports the -z option to invoke gzip transparently. gzip is designed as a complement to tar, not as a replacement

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.