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

Time for action – blending two images


Sometimes, the combined effect of two images mixed together makes a big impact compared to viewing the same images differently. Now it's time to give way to your imagination by blending two pictures together. In this example, our resultant image shows birds flying over the Mackinac bridge in Michigan. However, where did they come from? The birds were not there in the original image of the bridge.

  1. Download the following files from Packt website: 0165_3_28_BRIDGE2.png and 0165_3_29_BIRDS2.png. Rename these files as BRIDGE2.png and BIRDS2.png respectively.

  2. Add the following code in a Python source file.

    1 import Image
    2
    3 img1 = Image.open( "C:\\images\\BRIDGE2.png ")
    4 img1 = img1.convert('RGBA')
    5 
    6 img2 = Image.open( "C:\\images\\BIRDS2.png ")
    7 img2 = img2.convert('RGBA')
    8 
    9 img = Image.blend(img1, img2, 0.3)
    10 img.show()
    11 img.save( "C:\\images\\BLEND.png")
  3. The next illustration shows the two images before blending, represented by img1 and img2 in...