cool hit counter Send a high-fashion friend in Python_Intefrankly

Send a high-fashion friend in Python


Source: twofat ( Public: Big Data Frontier) Link.

Today I want to introduce you to a python library: the

PIL(python Image Library)

Here's a real-world example of what magic 50 lines of python code can do.

This is a circle of friends sent, before the cut is a picture, after the cut is nine pictures, successfully dominated the screen

In addition to working with regular square images, you can also work with non-regular images. For example, how do you handle the following image, which is much wider than its height?

It's simple, take the larger value between the width and height and fill it with white to construct a square image.

Of course, it's easy to make a picture look like this, as many photo manipulation apps on your phone can do it now.

This example is given just to give you an idea of PIL Library If you are interested in programming, you can also practice it.

All right, now check this out. PIL Library What the hell is it?

PIL is a very powerful Python image processing standard library, but then, since PIL supports Python 2.7, the The programmers who use Python3 have separated out another branch of PIL and created another library, Pillow, that is Python3-capable . Pillow is compatible with most of the syntax of PIL and is very easy to use.

Here's how the PIL library was used to implement the applet described above.

The idea is actually quite simple.

The corresponding codes are as follows.

I believe that you know how to implement the code, the code may be difficult to understand the corresponding comments are also given, you quickly download the code to take a run.

github address.

https://github.com/yangxuan0928/cut_image

Finally, some students asked in the background whether there is any crawler, Python basic class book recommendations, here I recommend two very good books, "Fluent Python" and "Python3 web crawler development practice", but also welcome you to leave a message you feel good python books.

(end)

Get something out of reading this article? Please forward and share to as many people as possible

Follow "Python stuff" and be a full-stack development engineer


Recommended>>
1、Text classification AI on Google devices achieves 867 percent accuracy
2、The 14th Skill Culture Festival Future Technology Changing Lives was officially opened
3、matlab2017a
4、A few very useful JQuery plugins that are compatible with Bootstrap
5、Python crawler of using Fiddler Postman Pythons requests module to crawl national flags

    已推荐到看一看 和朋友分享想法
    最多200字,当前共 发送

    已发送

    朋友将在看一看看到

    确定
    分享你的想法...
    取消

    分享想法到看一看

    确定
    最多200字,当前共

    发送中

    网络异常,请稍后重试

    微信扫一扫
    关注该公众号