
Open a file with a text editor and save it as textonvideo.py.
#PYTHON PUT TEXT ON IMAGE HOW TO#
Now that you know how to capture an image with a text, the next step will be to do it with a video. What we want is a writing tool when capturing video. But this is not what we set out in this article. The hope is in the next release, or the solution is to use another Python library that works on the images already captured (not at the time of acquisition). If right now you’re probably wondering … and now how can I move the message? Well, unfortunately this is not possible with picamera.
#PYTHON PUT TEXT ON IMAGE CODE#
Run the code and you’ll get an image of 2592 x 1944 pixels as a JGP file with about 2.4MB of size. If you followed the previous tutorials in other articles, the commands in the code will be familiar. Then write the following code camera.start_preview() In this example you will set the resolution 2592 x 1944 as indicated in the table for the acquisition of images. nano picamera01.pyįirst, you need to add the imports and the definition of PiCamera. Open a new file with a text editor, and name it, for example, picamera01.py. The table clearly illustrates the possible resolutions to be set to capture video or images properly.

The following Table has been taken from the official website of the Picamera library. The more of these pixels, the higher the resolution, the greater the detail in the picture.Īs for the PiCamera, you can define different resolutions before you capture an image or video. The resolution is an indicator of how the picture is defined in detail, or rather how many pixels are necessary to define an image. The resolution is the most important factor to be controlled if you want to shoot videos or capture the images properly. In fact, when you take a picture using the webcam, the scanned image quality can depend on many factors. Modify the PiCamera settingsīefore starting with the true examples, you must be aware of some configurations regarding the picamera. Finally, to conclude, a summary example about Video Surveillance with PiCamera – how to add the current time while shooting a video. You write a series of examples in Python to get familiar with these concepts. In this article, you will deepen some topics on picamera Library: how to configure the webcam settings and how to add text on the image. In addition, you become familiar with it, writing examples in Python (see here) and a tutorial you saw how to use it as a security camera (see here). MyFont = uetype('E:/PythonPillow/Fonts/FreeMono.ttf', 40)ĭ1.In previous articles you saw a general overview on using the integrable webcam on Raspberry board: the PiCamera.


Exampleįrom PIL import Image, ImageDraw, ImageFont
#PYTHON PUT TEXT ON IMAGE FULL#
We can either load fonts directly from the system by passing the full path to the function, or we can use the ImageFont to load a TrueType font. There are numerous ways to select the font used for writing on the image. If you save the above program as Example.py and execute, it will add the given text on it, and displays it using the standard PNG display utility, as follows − Selecting the font We can pass multiple other parameters to this method. You can write text on images by passing the location of the text, the text itself and the color of the text.
