وبلاگ بلیان

Python Multimedia. Beginner's Guide: Learn how to develop multimedia applications using Python with this practical step-by-step guide

معرفی کتاب «Python Multimedia. Beginner's Guide: Learn how to develop multimedia applications using Python with this practical step-by-step guide» نوشتهٔ Sathaye, Ninad، منتشرشده توسط نشر Packt Publishing در سال 2008. این کتاب در 290 صفحه، فرمت pdf، زبان انگلیسی ارائه شده است. «Python Multimedia. Beginner's Guide: Learn how to develop multimedia applications using Python with this practical step-by-step guide» در دستهٔ بدون دسته‌بندی قرار دارد.

Packt Publishing, 2010, 290 pages. Multimedia applications are used in a broad spectrum of fields. 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 very appealing. This book is all about multimedia processing using Python. This step by step guide gives you a hands-on experience with developing exciting multimedia applications. You will build applications for processing images, creating 2D animations and processing audio and video. 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 some of these (open source) libraries through several implausibly exciting projects. Popular multimedia frameworks and libraries, such as GStreamer, Pyglet, QT Phonon, and Python Imaging library are used to develop various multimedia applications. Cover 1 Copyright 3 Credits 4 About the Author 5 About the Reviewers 6 Table of Contents 10 Preface 18 Chapter 1: Python and Multimedia 24 Multimedia 25 Multimedia processing 25 Image processing 25 Audio and video processing 27 Compression 27 Mixing 28 Editing 28 Animations 28 Built-in multimedia support 29 winsound 29 audioop 29 wave 30 External multimedia libraries and frameworks 30 Python Imaging Library 30 PyMedia 30 GStreamer 30 Pyglet 31 PyGame 31 Sprite 31 Display 31 Surface 31 Draw 31 Event 32 Image 32 Music 32 Time for action – a simple application using PyGame 32 QT Phonon 35 Other multimedia libraries 36 Snack Sound Toolkit 36 PyAudiere 37 Summary 37 Chapter 2: Working with Images 38 Installation prerequisites 38 Python 38 Windows platform 39 Other platforms 39 Python Imaging Library \⠀倀䤀䰀尩 39 Windows platform 39 Other platforms 39 PyQt4 40 Windows platform 40 Other platforms 41 Summary of installation prerequisites 41 Reading and writing images 42 Time for action – image file converter 42 Creating an image from scratch 45 Time for action – creating a new image containing some text 45 Reading images from archive 46 Time for action – reading images from archives 46 Basic image manipulations 47 Resizing 47 Time for action – resizing 47 Rotating 50 Time for action – rotating 51 Flipping 52 Time for action – flipping 52 Capturing screenshots 53 Time for action – capture screenshots at intervals 53 Cropping 56 Time for action – cropping an image 56 Pasting 57 Time for action – pasting: mirror the smiley face! 57 Project: Thumbnail Maker 59 Time for action – play with Thumbnail Maker application 60 Generating the UI code 62 Time for action – generating the UI code 62 Connecting the widgets 64 Time for action – connecting the widgets 65 Developing the image processing code 66 Time for action – developing image processing code 66 Summary 70 Chapter 3: Enhancing Images 72 Installation and download prerequisites 73 Adjusting brightness and contrast 73 Time for action—adjusting brightness and contrast 73 Tweaking colors 76 Time for action – swap colors within an image! 76 Changing individual image band 78 Time for action – change the color of a flower 78 Gray scale images 80 Cook up negatives 81 Blending 82 Time for action – blending two images 82 Creating transparent images 85 Time for action – create transparency 85 Making composites with image mask 87 Time for action – making composites with image mask 88 Project: Watermark Maker Tool 89 Time for action – Watermark Maker Tool 90 Applying image filters 98 Smoothing 99 Time for action – smoothing an image 99 Sharpening 101 Blurring 101 Edge detection and enhancements 102 Time for action – detecting and enhancing edges 102 Embossing 104 Time for action – embossing 104 Adding a border 105 Time for action – enclosing a picture in a photoframe 106 Summary 107 Chapter 4: Fun with Animations 108 Installation prerequisites 109 Pyglet 109 Windows platform 109 Other platforms 109 Summary of installation prerequisites 110 Testing the installation 110 A primer on Pyglet 111 Important components 111 Window 111 Image 112 Sprite 112 Animation 112 AnimationFrame 112 Clock 112 Displaying an image 113 Mouse and keyboard controls 114 Adding sound effects 114 Animations with Pyglet 114 Viewing an existing animation 114 Time for action – viewing an existing animation 115 Animation using a sequence of images 117 Time for action – animation using a sequence of images 117 Single image animation 119 Time for action – bouncing ball animation 119 Project: a simple bowling animation 125 Time for action – a simple bowling animation 125 Animations using different image regions 130 Time for action – raindrops animation 131 Project: drive on a rainy day! 134 Time for action – drive on a rainy day! 135 Summary 139 Chapter 5: Working with Audios 140 Installation prerequisites 140 GStreamer 141 Windows platform 141 Other platforms 142 PyGobject 142 Windows platform 142 Other platforms 142 Summary of installation prerequisites 143 Testing the installation 144 A primer on GStreamer 144 gst-inspect and gst-launch 145 Elements and pipeline 145 Plugins 146 Bins 146 Pads 147 Dynamic pads 147 Ghost pads 148 Caps 148 Bus 148 Playbin/Playbin2 148 Playing music 149 Time for action – playing an audio: method 1 150 Building a pipeline from elements 154 Time for action – playing an audio: method 2 155 Playing an audio from a website 158 Converting audio file format 159 Time for action – audio file format converter 159 Extracting part of an audio 167 The Gnonlin plugin 168 Time for action – MP3 cutter! 169 Recording 173 Time for action – recording 174 Summary 177 Chapter 6: Audio Controls and Effects 178 Controlling playback 178 Play 179 Pause/resume 179 Time for action – pause and resume a playing audio stream 179 Stop 182 Fast-forward/rewind 183 Project: extract audio using playback controls 183 Time for action – MP3 cutter from basic principles 184 Adjusting volume 190 Time for action – adjusting volume 190 Audio effects 192 Fading effects 192 Time for action – fading effects 193 Echo echo echo... 196 Time for action – adding echo effect 196 Panning/panorama 199 Project: combining audio clips 200 Media 'timeline' explained 201 Time for action – creating custom audio by combining clips 202 Audio mixing 211 Time for action – mixing audio tracks 211 Visualizing an audio track 213 Time for action – audio visualizer 213 Summary 216 Chapter 7: Working with Videos 218 Installation prerequisites 219 Playing a video 220 Time for action – video player! 220 Playing video using 'playbin' 225 Video format conversion 226 Time for action – video format converter 226 Video manipulations and effects 232 Resizing 232 Time for action – resize a video 233 Cropping 234 Time for action – crop a video 235 Adjusting brightness and contrast 236 Creating a gray scale video 237 Adding text and time on a video stream 237 Time for action – overlay text on a video track 237 Separating audio and video tracks 240 Time for action – audio and video tracks 240 Mixing audio and video tracks 243 Time for action – audio/video track mixer 243 Saving video frames as images 247 Time for action – saving video frames as images 247 Summary 252 Chapter 8: GUI-based Media Players Using QT Phonon 254 Installation prerequisites 255 PyQt4 255 Summary of installation prerequisites 255 Introduction to QT Phonon 255 Main components 256 Media graph 256 Media object 256 Sink 256 Path 256 Effects 256 Backends 256 Modules 257 MediaNode 257 MediaSource 257 MediaObject 257 Path 257 AudioOutput 258 Effect 258 VideoPlayer 258 SeekSlider 258 volumeSlider 258 Project: GUI-based music player 258 GUI elements in the music player 259 Generating the UI code 260 Time for action – generating the UI code 260 Connecting the widgets 264 Time for action – connecting the widgets 264 Developing the audio player code 266 Time for action – developing the audio player code 267 Project: GUI-based video player 274 Generating the UI code 275 Time for action – generating the UI code 275 Connecting the widgets 277 Developing the video player code 278 Time for action – developing the video player code 278 Summary 281 Index 282 ISBN:,9781849510165

In Detail

Providing appealing plots and graphs is an essential part of various fields such as scientific research, data analysis, and so on. Matplotlib, the Python 2D plotting library, is used to produce publication-quality figures in a variety of hardcopy formats and interactive environments across platforms. This book explains creating various plots, histograms, power spectra, bar charts, error charts, scatter-plots and much more using the powerful Matplotlib library to get impressive out-of-the-box results.

This book gives you a comprehensive tour of the key features of the Matplotlib Python 2D plotting library, right from the simplest concepts to the most advanced topics. You will discover how easy it is to produce professional-quality plots when you have this book to hand.

The book introduces the library in steps. First come the basics: introducing what the library is, its important prerequisites (and terminology), installing and configuring Matplotlib, and going through simple plots such as lines, grids, axes, and charts. Then we start with some introductory examples, and move ahead by discussing the various programming styles that Matplotlib allows, and several key features.

Further, the book presents an important section on embedding applications. You will be introduced to three of the best known GUI libraries-GTK+, Qt, and wxWidgets-and presented with the steps to implement to include Matplotlib in an application written using each of them. You will learn through an incremental approach: from a simple example that presents the peculiarities of the GUI library, to more complex ones, using GUI designer tools.

Because the Web permeates all of our activities, a part of the book is dedicated to showing how Matplotlib can be used in a web environment, and another section focuses on using Matplotlib with common Python web frameworks, namely, Pylons and Django. Last, but not least, you will go through real-world examples, where you will see some real situations in which you can use Matplotlib.

This book is a step-by-step tutorial to the Python 2D plotting library Matplotlib, which teaches you from the ground up to advanced levels with plenty of examples, code, and images.

Approach

This is a practical, hands-on book, with a lot of code and images. It presents the real code that generates every image and describes almost every single line of it, so that you know exactly what's going on.

Introductory, descriptive, and theoretical parts are mixed with examples, so that reading and understanding them is easy. All of the examples build gradually with code snippets, their explanations, and plot images where necessary with the complete code and output presented at the end.

Who this book is for

This book is essentially for Python developers who have a good knowledge of Python; no knowledge of Matplotlib is required. You will be creating 2D plots using Matplotlib in no time at all.

Learn how to develop Multimedia applications using Python with this practical step-by-step guideKey FeaturesUse Python Imaging Library for digital image processing.Create exciting 2D cartoon characters using Pyglet multimedia frameworkCreate GUI-based audio and video players using QT Phonon framework.Get to grips with the primer on GStreamer multimedia framework and use this API for audio and video processing.Book DescriptionMultimedia 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.What you will learnHow to develop utilities for some frequently needed image processing operations such as resizing, brightness and contrast adjustment, flipping and rotating images, and so on.How to digitally enhance images using image filters.How to blend images together, creating watermarks, thumbnails, and so on.How to write audio and video file format conversion utilities.How to combine two or more audio tracks, mixing audio and video tracks.How to develop an MP3 file cutter tool to extract a portion of audio.How to separate audio and video tracks.How to develop programs to record sound, visualize audio tracks, add special audio effects such as fading, echo, and so on.How to save video frames as still images.Who this book is forThis book is for Python developers who want to dip their toes into working with images, animations, audio and video processing using Python.

In Detail

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.

Learn how to develop Multimedia applications using Python with this practical step-by-step guide

Approach

A practical guide, this book provides step-by-step instructions for developing multimedia applications, showcasing real world examples throughout.

Who this book is for

This book is for Python developers who want to dip their toes into working with images, animations, audio and video processing using Python.

In Detail

Python is a dynamic programming language, used in a wide range of domains by programmers who find it simple, yet powerful. From the earliest version 15 years ago to the current one, it has constantly evolved with productivity and code readability in mind.

Even if you find writing Python code easy, writing code that is efficient and easy to maintain and reuse is not so straightforward. This book will show you how to do just that:  it will show you how Python development should be done. Python expert Tarek Ziad takes you on a practical tour of Python application development, beginning with setting up the best development environment, and along the way looking at agile methodologies in Python, and applying proven object-oriented principles to your design.

Approach

This book is an authoritative exploration of Python best practices and applications of agile methodologies to Python, illustrated with practical, real-world examples.

Who this book is for

This book is for Python developers who are already building applications, but want to build better ones by applying best practices and new development techniques to their projects.

The reader is expected to have a sound background in Python programming.

'This is a practical hands-on book with clear instructions and lot of code examples. It takes a simple approach, guiding you through different architectural topics using realistic sample projects. A single project is implemented using different architectural styles to make the reader understand the details of each style. There are also many small independent code samples to explain design patterns, WCF, and localization. This book is for people familiar with the ASP.NET framework using either C# or VB.NET. You don't need to be an ASP.NET guru – the book is ideal for novice and intermediate developers. If reading about application architecture usually confuses you or sends you to sleep, then this book will be perfect for you! In short, any ASP.NET programmer who is confused or disoriented reading different books or materials on architectures wondering how and what to implement in their application, will definitely benefit from this book!' Annotation. Python is a dynamic programming language, used in a wide range of domains by programmers who find it simple, yet powerful. From the earliest version 15 years ago to the current one, it has constantly evolved with productivity and code readability in mind. Even if you find writing Python code easy, writing code that is efficient and easy to maintain and reuse is not so straightforward. This book will show you how to do just that: it will show you how Python development should be done. Python expert Tarek Ziad{uFFFD} takes you on a practical tour of Python application development, beginning with setting up the best development environment, and along the way looking at agile methodologies in Python, and applying proven object-oriented principles to your design Python is a dynamic programming language, used in a wide range of domains by programmers who find it simple, yet powerful. From the earliest version 15 years ago to the current one, it has constantly evolved with productivity and code readability in mind. Even if you find writing Python code easy, writing code that is efficient and easy to maintain and reuse is not so straightforward. This book will show you how to do just that: it will show you how Python development should be done. Python expert Tarek Ziadé takes you on a practical tour of Python application development, beginning with setting up the best development environment, and along the way looking at agile methodologies in Python, and applying proven object-oriented principles to your design. This is a practical, hands-on book, with a lot of code and images. It presents the real code that generates every image and describes almost every single line of it, so that you know exactly what's going on. Introductory, descriptive, and theoretical parts are mixed with examples, so that reading and understanding them is easy. All of the examples build gradually with code snippets, their explanations, and plot images where necessary with the complete code and output presented at the end. This book is essentially for Python developers who have a good knowledge of Python; no knowledge of Matplotlib is required. You will be creating 2D plots using Matplotlib in no time at all.
دانلود کتاب Python Multimedia. Beginner's Guide: Learn how to develop multimedia applications using Python with this practical step-by-step guide