官术网_书友最值得收藏!

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
主站蜘蛛池模板: 德州市| 平罗县| 信宜市| 卫辉市| 洛川县| 罗城| 榆树市| 大余县| 望江县| 阜城县| 滁州市| 页游| 密山市| 池州市| 鹤壁市| 红桥区| 泸州市| 仁寿县| 贵溪市| 中江县| 时尚| 福贡县| 长春市| 巨鹿县| 阿拉善右旗| 新乡市| 霍林郭勒市| 涟源市| 青海省| 肇源县| 贵南县| 西藏| 棋牌| 清水河县| 五常市| 遂川县| 泌阳县| 泽州县| 绩溪县| 体育| 阿克苏市|