Installing Pil | Beginning Python: Installing Pil/pillow | Packtpub.com

Packt Video

Subscribe Here





Beginning Python: Installing Pil/pillow | Packtpub.com


You welcome! This is section eight, and we are going to be looking at pipe and picture manipulation in this section. We will be using the Python imaging library to do picture transformations and manipulations. This could include things like rotating images, cropping images or even changing the brightness or exposure on an image for this video. However, we will simply look at how to install the Python imaging library or more specifically, we will look into how to use the command line tool, PIP2 install Python third-party libraries. We might be interested in installing, and once we have done that. We will construct a simple script that can load and display an image using the new library. We have just installed our first step in installing. Pil / Pillow is to go to the pillow website on the installation page at this URL for your information. The Python Imaging Library is a dead project, so a group of developers did a fork of the Python Imaging Library and called it pillow, which is currently being maintained and updated. So we want install pillow which uses code from the old python imaging library so to install pillow. You need to make sure that Pil is not on your system. Here’s a warning sign That says they cannot coexist all in the same environment. So if you have the python imaging library, you need to remove it from your system next, depending on your operating system, there are different ways of installing a pillow, but the easiest way is to use the command line tool called P IP, so go to your terminal and type P IP install Pillow. P IP should have came with Python 3.4 which we installed or maybe called PIP3, but in either case, if you do not have it, you can go to the P IP website at this URL. Download this python file, call it get – Tik-tok Py, And once you have downloaded it, you can install P IP using python and run the script. You just ran called get P IP and it will install it for you very simple. Now if you are on Os X like I am, you can also do P IP install pillow, and if you are having trouble with that, I recommend that you run the following commands, Xcode select – – install and Xcode and build the license because it needs the Xcode command-line tools to install the blow software. So let me show you guys how to do that. I already have the Xcode command line tools so to install pillow or H do is say Sue. Do for Super User. Do P IP install pillow, then I type in my password, and then it goes, fetches that third-party library and installed it for me if you want to check that there type P IP list and here are all the third-party libraries. I have on my machine, but one of them is called pillow and we can spit version number right here now that we have installed pillow. We are ready to do some image manipulations, but before we do that notice that I have a new shebang line and this shebang line simply calls the normal Python interpreter on your current path as opposed to the Python 3.4 interpreter that we are traditionally using the reason. I am using the normal Python interpreter which on my machine is Python 2 This is because pillow is much easier to install for Python 2 as opposed to Python 3 so we will stick with Python 2 just for this section, However, pillow is also available for Python 3 for those of you who are interested now back to using pillow. So one thing we need to do is say from. Pil, import image notice I didn’t say import pillow and the reason is for backwards. Compatibility reasons pillow has kept Pil in the import. So now we need an image to work with well. I already have an image in my directory called the Rose Dot JPG and that is this image and I want to display it in preview, so I’m going to create a variable called Rose image. I’m going to say image Dot open Rose dot JPG. This will create a Rose image object that I can call methods on and one of the methods I can call is Rose thought show, which will simply give me a preview of what my image currently looks like and when I run that it opens the preview application, and I see my rose in this video. We looked at how to install the Python Imaging Library.

0.3.0 | Wor Build 0.3.0 Installation Guide

Transcript: [MUSIC] Okay, so in this video? I want to take a look at the new windows on Raspberry Pi build 0.3.0 and this is the latest version. It's just been released today and this version you have to build by yourself. You have to get your own whim, and then you...

read more