Time for action – reading images from archives

Suppose there is an archive file images.tar containing image file image1.jpg. The following code snippet shows how to read image1.jpg from the tarball.

>>>import TarIO
>>>import Images
>>>fil = TarIO.TarIO("images.tar", "images/image1.jpg") 
>>>img = Image.open(fil)
>>>img.show()

What just happened?

We learned how to read an image located in an archived container.

Have a go hero – add new features to the image file converter

Modify the image conversion code so that it supports the following new functionality, which:

  1. Takes a ZIP file containing images as input
  2. Creates a TAR archive of the converted images