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

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
主站蜘蛛池模板: 延安市| 来凤县| 于都县| 周至县| 资源县| 鹿邑县| 武川县| 西和县| 婺源县| 玛沁县| 许昌县| 舟曲县| 五寨县| 惠来县| 平安县| 西乌珠穆沁旗| 宝清县| 赫章县| 和政县| 北辰区| 灵丘县| 宁晋县| 无极县| 杨浦区| 咸宁市| 秦安县| 紫阳县| 合水县| 错那县| 天水市| 昌宁县| 会泽县| 绥宁县| 偃师市| 新建县| 淳安县| 定西市| 贺州市| 万源市| 南城县| 靖州|