Book Image

Python Multimedia

By : Ninad Sathaye
Book Image

Python Multimedia

By: Ninad Sathaye

Overview of this book

Multimedia applications are used by a range of industries to enhance the visual appeal of a product. This book will teach the reader how to perform multimedia processing using Python. This step-by-step guide gives you hands-on experience for developing exciting multimedia applications using Python. This book will help you to build applications for processing images, creating 2D animations and processing audio and video. Writing applications that work with images, videos, and other sensory effects is great. Not every application gets to make full use of audio/visual effects, but a certain amount of multimedia makes any application a lot more appealing. There are numerous multimedia libraries for which Python bindings are available. These libraries enable working with different kinds of media, such as images, audio, video, games, and so on. This book introduces the reader to the most widely used open source libraries through several exciting, real world projects. Popular multimedia frameworks and libraries such as GStreamer,Pyglet, QT Phonon, and Python Imaging library are used to develop various multimedia applications.
Table of Contents (13 chapters)
Python Multimedia Beginner's Guide
Credits
About the Author
About the Reviewers
Preface

Making composites with image mask


So far, we have already seen how to blend two images together. It was done using the Image.blend operation where the two input images were blended by using a constant alpha transparency factor. In this section, we will learn another technique to combine two images together. Here, instead of a constant alpha factor, an image instance that defines the transparency mask is used as the third argument. Another difference is that the input images need not have the same mode . For instance, the first image can be with mode L and the second with mode RGBA. The syntax to create composite images is:

outImage = Image.composite(img1, img2, mask)

Here, the arguments to the composite method are Image instances. The mask is specified as alpha. The mode for mask image instance can be 1, L, or RGBA.