SlideShare uma empresa Scribd logo
1 de 27
Python Media
Library
Python is a very powerful language that can accomplish many
tasks such as image manipulation(The process of editing an
image is called image manipulation). Processing a video
means, performing operations on the video frame by frame.
Frames are nothing but just the particular instance of the
video in a single point of time.
Pillow is built on top of PIL (Python Image Library).
PIL is one of the important modules for image
processing in Python. Pillow supports a large number
of image file formats including BMP, PNG, JPEG, and
TIFF. It incorporates lightweight image processing
tools that aids in editing, creating and saving images.
Python Imaging Library
This method is used to display the image. For displaying
the image Pillow first converts the image to a .png format
(on Windows OS) and stores it in a temporary buffer and
then displays it.
from PIL import Image
img =
Image.open(r“pic1.png")
#Open image
img.show()
#Display image
To resize an image, you call
the resize() method on it,
passing in a two-integer tuple
argument representing the
width and height of the resized
image.
from PIL import Image
size = (40, 40)
img =
Image.open(r“pic1.png")
img1 = img.resize(size)
img1.show()
Example
Image rotation is done
by specific angles and
for that again specific
keywords need to
passed. You can rotate
image 90 degree, 45
degree, 180 degree etc.
Rotating Images
Example
from PIL import Image
# Open image using
Image module
n= Image.open(“girl.jpg”)
# Show actual image
n.show()
#show rotated image
n =n.rotate(45)
n.show()
Rotated image
It applies a blurring effect on to the image as
specified through a specific kernel or a
convolution matrix.
Syntax
filter(ImageFilter.BLUR)
Blurred Image
#Import required Image library from PIL
import Image, ImageFilter
OriImage = Image.open('girl.jpg')
OriImage.show()
blurImage =
OriImage.filter(ImageFilter.BLUR)
blurImage.show() #Save blurImage
blurImage.save(‘girl.jpg')
Example
While using the save() method
Destination path must have
the image filename and
extension as well. The
extension could be omitted in
Destination path if the
extension is specified in the
format argument.
from PIL import Image
size = (40, 40)
img = Image.open(r“pic1.png")
r_img = img.resize(size, resample = Image.BILINEAR)
# resized_test.png => Destination_path
r_img.save("resized_pic1.png")
# Opening the new image
img = Image.open(r"resized_pic1.png“)
print(img.size)
Show Image
Resize Image
Rotate Image
Blured Image
Pillow Library allow you to perform difference task such
show image, resize image, rotate image, blurred image
etc.
OpenCV VideoCapture
OpenCV provides the VideoCature() function
which is used to work with the Camera. We
can do the following task:
Read video, display video, and save video.
Capture from the camera and display it.
The cv2.imwrite() function is used to save the video
into the file. First, we need to create a VideoWriter
object. Then we should specify the FourCC code and
the number of frames per second (fps). The frame
size should be passed within the function.
Saving a Video
import cv2
import numpy as np
cap = cv2.VideoCapture(0)
while(True):
ret, frame = cap.read() # Capture image frame-by-frame
# Our operations on the frame come here
gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY)
cv2.imshow('frame',gray) # Display the resulting frame
if cv2.waitKey(1) & 0xFF == ord('q'):
break
# When everything done, release the capture
cap.release()
cv2.destroyAllWindows()
Example
import numpy as np
import cv2
cap = cv2.VideoCapture(0)
fourcc = cv2.VideoWriter_fourcc(*'XVID')
out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480))
while(cap.isOpened()):
ret, frame = cap.read()
if ret==True:
frame = cv2.flip(frame,0)
# write the flipped frame
out.write(frame)
cv2.imshow('frame',frame)
if cv2.waitKey(1) & 0xFF == ord('q'):
break
else:
break
cap.release()
out.release()
cv2.destroyAllWindows()
Saving a Video
MoviePy
MoviePy is a Python module for video
editing, which can be used for basic
operations (like cuts, concatenations,
title insertions), video compositing
(a.k.a. non-linear editing), video
processing, or to create advanced
effects. It can read and write the most
common video formats, including GIF.
We will load the video and we will cut a clip
from the whole video then we will add text in
the video, in this example we have to install
ImageMagick otherwise it will not work.
Example
from moviepy.editor import *
clip = VideoFileClip("dsa_v.webm“)
# loading video dsa gfg intro video
# getting video for only starting 10 seconds
clip = clip.subclip(0, 10)
clip = clip.volumex(0.8) # Reduce the audio volume (volume x 0.8)
# Generate a text clip
txt_clip = TextClip(“RaginiTutorial", fontsize = 50, color = 'white‘)
txt_clip = txt_clip.set_pos('center').set_duration(10)
# Overlay the text clip on the first video clip
video = CompositeVideoClip([clip, txt_clip])# showing video
video.ipython_display(width = 280)
Python offers multiple libraries to ease
our work. Here we will learn how to
take a screenshot using Python.
Python provides a module
called pyscreenshot for this task. It is
only a pure Python wrapper, a thin
layer over existing backends.
Performance and interactivity are not
important for this library.
import pyscreenshot
# To capture the screen
image = pyscreenshot.grab()
#To display the captured
screenshot
image.show()
# To save the screenshot
image.save(“schreenshot2.png")
Example
Here is the simple Python
program to capture the part of
the screen. Here we need to
provide the pixel positions in
the grab() function. We need
to pass the coordinates in the
form of a tuple.
import pyscreenshot
image=pyscreenshot.grab(bbox=(10,10,500, 500))
image.show() # To view the screenshot
image.save(“screenshot1.png“)
Example
For more presentation in
any subject please contact
us
raginijain0208@gmail.com
Python media library

Mais conteúdo relacionado

Mais procurados

Chapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementChapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementVarun Ojha
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Project Student
 
OLAP operations
OLAP operationsOLAP operations
OLAP operationskunj desai
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Ulaş Bağcı
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning Gopal Sakarkar
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compressionasodariyabhavesh
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation pptGichelle Amon
 
Image Based Steganpgraphy
Image Based SteganpgraphyImage Based Steganpgraphy
Image Based SteganpgraphyOmkar Rane
 
Digital watermarking
Digital watermarkingDigital watermarking
Digital watermarkingAnkush Kr
 
Developing R Graphical User Interfaces
Developing R Graphical User InterfacesDeveloping R Graphical User Interfaces
Developing R Graphical User InterfacesSetia Pramana
 
Multi media Data mining
Multi media Data miningMulti media Data mining
Multi media Data mininghome
 
Region based image segmentation
Region based image segmentationRegion based image segmentation
Region based image segmentationSafayet Hossain
 
Steganography
Steganography Steganography
Steganography Uttam Jain
 
MPEG video compression standard
MPEG video compression standardMPEG video compression standard
MPEG video compression standardanuragjagetiya
 
CS 402 DATAMINING AND WAREHOUSING -MODULE 6
CS 402 DATAMINING AND WAREHOUSING -MODULE 6CS 402 DATAMINING AND WAREHOUSING -MODULE 6
CS 402 DATAMINING AND WAREHOUSING -MODULE 6NIMMYRAJU
 

Mais procurados (20)

Image compression .
Image compression .Image compression .
Image compression .
 
Chapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image EnhancementChapter 6 Image Processing: Image Enhancement
Chapter 6 Image Processing: Image Enhancement
 
Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)Data Compression (Lossy and Lossless)
Data Compression (Lossy and Lossless)
 
Jpeg and mpeg ppt
Jpeg and mpeg pptJpeg and mpeg ppt
Jpeg and mpeg ppt
 
Lzw coding technique for image compression
Lzw coding technique for image compressionLzw coding technique for image compression
Lzw coding technique for image compression
 
OLAP operations
OLAP operationsOLAP operations
OLAP operations
 
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
Lec7: Medical Image Segmentation (I) (Radiology Applications of Segmentation,...
 
Data preprocessing using Machine Learning
Data  preprocessing using Machine Learning Data  preprocessing using Machine Learning
Data preprocessing using Machine Learning
 
Chapter 8 image compression
Chapter 8 image compressionChapter 8 image compression
Chapter 8 image compression
 
Image segmentation ppt
Image segmentation pptImage segmentation ppt
Image segmentation ppt
 
Image Based Steganpgraphy
Image Based SteganpgraphyImage Based Steganpgraphy
Image Based Steganpgraphy
 
Digital watermarking
Digital watermarkingDigital watermarking
Digital watermarking
 
Developing R Graphical User Interfaces
Developing R Graphical User InterfacesDeveloping R Graphical User Interfaces
Developing R Graphical User Interfaces
 
Image compression
Image compressionImage compression
Image compression
 
Multi media Data mining
Multi media Data miningMulti media Data mining
Multi media Data mining
 
Region based image segmentation
Region based image segmentationRegion based image segmentation
Region based image segmentation
 
Steganography
Steganography Steganography
Steganography
 
JPEG Image Compression
JPEG Image CompressionJPEG Image Compression
JPEG Image Compression
 
MPEG video compression standard
MPEG video compression standardMPEG video compression standard
MPEG video compression standard
 
CS 402 DATAMINING AND WAREHOUSING -MODULE 6
CS 402 DATAMINING AND WAREHOUSING -MODULE 6CS 402 DATAMINING AND WAREHOUSING -MODULE 6
CS 402 DATAMINING AND WAREHOUSING -MODULE 6
 

Semelhante a Python media library

Python imaging-library-overview - [cuuduongthancong.com]
Python imaging-library-overview - [cuuduongthancong.com]Python imaging-library-overview - [cuuduongthancong.com]
Python imaging-library-overview - [cuuduongthancong.com]Dinh Sinh Mai
 
Random And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python CgiRandom And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python CgiAkramWaseem
 
What is image in Swift?/はるふ
What is image in Swift?/はるふWhat is image in Swift?/はるふ
What is image in Swift?/はるふha1f Yamaguchi
 
Performance and Memory Tuning - Part III - Transcript.pdf
Performance and Memory Tuning - Part III - Transcript.pdfPerformance and Memory Tuning - Part III - Transcript.pdf
Performance and Memory Tuning - Part III - Transcript.pdfShaiAlmog1
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgroundsnobel mujuji
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricksShem Magnezi
 
Image Handling in iOS_InnovationM
Image Handling in iOS_InnovationMImage Handling in iOS_InnovationM
Image Handling in iOS_InnovationMInnovationM
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham SiddiquiMuhammad Ehtisham Siddiqui
 
Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a WebcamIntellovations, LLC
 
Introduction to Machine Learning by MARK
Introduction to Machine Learning by MARKIntroduction to Machine Learning by MARK
Introduction to Machine Learning by MARKMRKUsafzai0607
 
The Ring programming language version 1.7 book - Part 51 of 196
The Ring programming language version 1.7 book - Part 51 of 196The Ring programming language version 1.7 book - Part 51 of 196
The Ring programming language version 1.7 book - Part 51 of 196Mahmoud Samir Fayed
 
Android UI Tips & Tricks
Android UI Tips & TricksAndroid UI Tips & Tricks
Android UI Tips & TricksDroidConTLV
 
Mathematical operations in image processing
Mathematical operations in image processingMathematical operations in image processing
Mathematical operations in image processingAsad Ali
 

Semelhante a Python media library (20)

Python imaging-library-overview - [cuuduongthancong.com]
Python imaging-library-overview - [cuuduongthancong.com]Python imaging-library-overview - [cuuduongthancong.com]
Python imaging-library-overview - [cuuduongthancong.com]
 
Topic 1_PPT.pptx
Topic 1_PPT.pptxTopic 1_PPT.pptx
Topic 1_PPT.pptx
 
Random And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python CgiRandom And Dynamic Images Using Python Cgi
Random And Dynamic Images Using Python Cgi
 
Resize image vb.net
Resize image vb.netResize image vb.net
Resize image vb.net
 
What is image in Swift?/はるふ
What is image in Swift?/はるふWhat is image in Swift?/はるふ
What is image in Swift?/はるふ
 
Performance and Memory Tuning - Part III - Transcript.pdf
Performance and Memory Tuning - Part III - Transcript.pdfPerformance and Memory Tuning - Part III - Transcript.pdf
Performance and Memory Tuning - Part III - Transcript.pdf
 
Html images and html backgrounds
Html images and html backgroundsHtml images and html backgrounds
Html images and html backgrounds
 
Android ui tips & tricks
Android ui tips & tricksAndroid ui tips & tricks
Android ui tips & tricks
 
Chapter1 8
Chapter1 8Chapter1 8
Chapter1 8
 
Image Handling in iOS_InnovationM
Image Handling in iOS_InnovationMImage Handling in iOS_InnovationM
Image Handling in iOS_InnovationM
 
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation  Websites Session 7 by Muhammad Ehtisham SiddiquiBuilding Next Generation  Websites Session 7 by Muhammad Ehtisham Siddiqui
Building Next Generation Websites Session 7 by Muhammad Ehtisham Siddiqui
 
Observational Science With Python and a Webcam
Observational Science With Python and a WebcamObservational Science With Python and a Webcam
Observational Science With Python and a Webcam
 
Introduction to Machine Learning by MARK
Introduction to Machine Learning by MARKIntroduction to Machine Learning by MARK
Introduction to Machine Learning by MARK
 
Editing session 1
Editing session 1Editing session 1
Editing session 1
 
Chtp430
Chtp430Chtp430
Chtp430
 
The Ring programming language version 1.7 book - Part 51 of 196
The Ring programming language version 1.7 book - Part 51 of 196The Ring programming language version 1.7 book - Part 51 of 196
The Ring programming language version 1.7 book - Part 51 of 196
 
Android UI Tips & Tricks
Android UI Tips & TricksAndroid UI Tips & Tricks
Android UI Tips & Tricks
 
Vanmathy python
Vanmathy python Vanmathy python
Vanmathy python
 
Mathematical operations in image processing
Mathematical operations in image processingMathematical operations in image processing
Mathematical operations in image processing
 
M14 overview
M14 overviewM14 overview
M14 overview
 

Mais de RaginiJain21

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in pythonRaginiJain21
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in pythonRaginiJain21
 
Conditionalstatement
ConditionalstatementConditionalstatement
ConditionalstatementRaginiJain21
 
Basic python programs
Basic python programsBasic python programs
Basic python programsRaginiJain21
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and ModulesRaginiJain21
 
Data types in python
Data types in pythonData types in python
Data types in pythonRaginiJain21
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on pythonRaginiJain21
 

Mais de RaginiJain21 (8)

Jump statment in python
Jump statment in pythonJump statment in python
Jump statment in python
 
Looping statement in python
Looping statement in pythonLooping statement in python
Looping statement in python
 
Conditionalstatement
ConditionalstatementConditionalstatement
Conditionalstatement
 
Basic python programs
Basic python programsBasic python programs
Basic python programs
 
Python Libraries and Modules
Python Libraries and ModulesPython Libraries and Modules
Python Libraries and Modules
 
Data types in python
Data types in pythonData types in python
Data types in python
 
Python second ppt
Python second pptPython second ppt
Python second ppt
 
Final presentation on python
Final presentation on pythonFinal presentation on python
Final presentation on python
 

Último

Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Vinodha Devi
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...ssifa0344
 
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...dipikadinghjn ( Why You Choose Us? ) Escorts
 
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Availabledollysharma2066
 
Indore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdfIndore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdfSaviRakhecha1
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...priyasharma62062
 
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...priyasharma62062
 
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...Call Girls in Nagpur High Profile
 
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort ServiceDelhi Call girls
 
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaiVasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaipriyasharma62062
 
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...Call Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Call Girls in Nagpur High Profile
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...ssifa0344
 
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Call Girls in Nagpur High Profile
 
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Call Girls in Nagpur High Profile
 
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...dipikadinghjn ( Why You Choose Us? ) Escorts
 
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...dipikadinghjn ( Why You Choose Us? ) Escorts
 

Último (20)

Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.Gurley shaw Theory of Monetary Economics.
Gurley shaw Theory of Monetary Economics.
 
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
TEST BANK For Corporate Finance, 13th Edition By Stephen Ross, Randolph Weste...
 
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...
( Jasmin ) Top VIP Escorts Service Dindigul 💧 7737669865 💧 by Dindigul Call G...
 
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
VIP Call Girl Service Andheri West ⚡ 9920725232 What It Takes To Be The Best ...
 
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
8377087607, Door Step Call Girls In Kalkaji (Locanto) 24/7 Available
 
Indore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdfIndore Real Estate Market Trends Report.pdf
Indore Real Estate Market Trends Report.pdf
 
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Koregaon Park Call Me 7737669865 Budget Friendly No Advance Booking
 
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
Mira Road Memorable Call Grls Number-9833754194-Bhayandar Speciallty Call Gir...
 
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
Kharghar Blowjob Housewife Call Girls NUmber-9833754194-CBD Belapur Internati...
 
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...Top Rated  Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
Top Rated Pune Call Girls Sinhagad Road ⟟ 6297143586 ⟟ Call Me For Genuine S...
 
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort ServiceEnjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort Service
Enjoy Night⚡Call Girls Patel Nagar Delhi >༒8448380779 Escort Service
 
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbaiVasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
Vasai-Virar Fantastic Call Girls-9833754194-Call Girls MUmbai
 
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...Booking open Available Pune Call Girls Talegaon Dabhade  6297143586 Call Hot ...
Booking open Available Pune Call Girls Talegaon Dabhade 6297143586 Call Hot ...
 
Top Rated Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated  Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...Top Rated  Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
Top Rated Pune Call Girls Pashan ⟟ 6297143586 ⟟ Call Me For Genuine Sex Serv...
 
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
Solution Manual for Financial Accounting, 11th Edition by Robert Libby, Patri...
 
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...Top Rated  Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
Top Rated Pune Call Girls Aundh ⟟ 6297143586 ⟟ Call Me For Genuine Sex Servi...
 
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...Top Rated  Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
Top Rated Pune Call Girls Shikrapur ⟟ 6297143586 ⟟ Call Me For Genuine Sex S...
 
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
VIP Call Girl in Mumbai Central 💧 9920725232 ( Call Me ) Get A New Crush Ever...
 
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
VIP Call Girl in Thane 💧 9920725232 ( Call Me ) Get A New Crush Everyday With...
 
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
VIP Call Girl in Mira Road 💧 9920725232 ( Call Me ) Get A New Crush Everyday ...
 

Python media library

  • 2. Python is a very powerful language that can accomplish many tasks such as image manipulation(The process of editing an image is called image manipulation). Processing a video means, performing operations on the video frame by frame. Frames are nothing but just the particular instance of the video in a single point of time.
  • 3. Pillow is built on top of PIL (Python Image Library). PIL is one of the important modules for image processing in Python. Pillow supports a large number of image file formats including BMP, PNG, JPEG, and TIFF. It incorporates lightweight image processing tools that aids in editing, creating and saving images. Python Imaging Library
  • 4. This method is used to display the image. For displaying the image Pillow first converts the image to a .png format (on Windows OS) and stores it in a temporary buffer and then displays it.
  • 5. from PIL import Image img = Image.open(r“pic1.png") #Open image img.show() #Display image
  • 6. To resize an image, you call the resize() method on it, passing in a two-integer tuple argument representing the width and height of the resized image.
  • 7. from PIL import Image size = (40, 40) img = Image.open(r“pic1.png") img1 = img.resize(size) img1.show() Example
  • 8. Image rotation is done by specific angles and for that again specific keywords need to passed. You can rotate image 90 degree, 45 degree, 180 degree etc. Rotating Images Example from PIL import Image # Open image using Image module n= Image.open(“girl.jpg”) # Show actual image n.show() #show rotated image n =n.rotate(45) n.show()
  • 10. It applies a blurring effect on to the image as specified through a specific kernel or a convolution matrix. Syntax filter(ImageFilter.BLUR) Blurred Image
  • 11. #Import required Image library from PIL import Image, ImageFilter OriImage = Image.open('girl.jpg') OriImage.show() blurImage = OriImage.filter(ImageFilter.BLUR) blurImage.show() #Save blurImage blurImage.save(‘girl.jpg') Example
  • 12.
  • 13. While using the save() method Destination path must have the image filename and extension as well. The extension could be omitted in Destination path if the extension is specified in the format argument.
  • 14. from PIL import Image size = (40, 40) img = Image.open(r“pic1.png") r_img = img.resize(size, resample = Image.BILINEAR) # resized_test.png => Destination_path r_img.save("resized_pic1.png") # Opening the new image img = Image.open(r"resized_pic1.png“) print(img.size)
  • 15. Show Image Resize Image Rotate Image Blured Image Pillow Library allow you to perform difference task such show image, resize image, rotate image, blurred image etc.
  • 16. OpenCV VideoCapture OpenCV provides the VideoCature() function which is used to work with the Camera. We can do the following task: Read video, display video, and save video. Capture from the camera and display it.
  • 17. The cv2.imwrite() function is used to save the video into the file. First, we need to create a VideoWriter object. Then we should specify the FourCC code and the number of frames per second (fps). The frame size should be passed within the function. Saving a Video
  • 18. import cv2 import numpy as np cap = cv2.VideoCapture(0) while(True): ret, frame = cap.read() # Capture image frame-by-frame # Our operations on the frame come here gray = cv2.cvtColor(frame, cv2.COLOR_BGR2GRAY) cv2.imshow('frame',gray) # Display the resulting frame if cv2.waitKey(1) & 0xFF == ord('q'): break # When everything done, release the capture cap.release() cv2.destroyAllWindows() Example
  • 19. import numpy as np import cv2 cap = cv2.VideoCapture(0) fourcc = cv2.VideoWriter_fourcc(*'XVID') out = cv2.VideoWriter('output.avi',fourcc, 20.0, (640,480)) while(cap.isOpened()): ret, frame = cap.read() if ret==True: frame = cv2.flip(frame,0) # write the flipped frame out.write(frame) cv2.imshow('frame',frame) if cv2.waitKey(1) & 0xFF == ord('q'): break else: break cap.release() out.release() cv2.destroyAllWindows() Saving a Video
  • 20. MoviePy MoviePy is a Python module for video editing, which can be used for basic operations (like cuts, concatenations, title insertions), video compositing (a.k.a. non-linear editing), video processing, or to create advanced effects. It can read and write the most common video formats, including GIF.
  • 21. We will load the video and we will cut a clip from the whole video then we will add text in the video, in this example we have to install ImageMagick otherwise it will not work. Example
  • 22. from moviepy.editor import * clip = VideoFileClip("dsa_v.webm“) # loading video dsa gfg intro video # getting video for only starting 10 seconds clip = clip.subclip(0, 10) clip = clip.volumex(0.8) # Reduce the audio volume (volume x 0.8) # Generate a text clip txt_clip = TextClip(“RaginiTutorial", fontsize = 50, color = 'white‘) txt_clip = txt_clip.set_pos('center').set_duration(10) # Overlay the text clip on the first video clip video = CompositeVideoClip([clip, txt_clip])# showing video video.ipython_display(width = 280)
  • 23. Python offers multiple libraries to ease our work. Here we will learn how to take a screenshot using Python. Python provides a module called pyscreenshot for this task. It is only a pure Python wrapper, a thin layer over existing backends. Performance and interactivity are not important for this library.
  • 24. import pyscreenshot # To capture the screen image = pyscreenshot.grab() #To display the captured screenshot image.show() # To save the screenshot image.save(“schreenshot2.png") Example
  • 25. Here is the simple Python program to capture the part of the screen. Here we need to provide the pixel positions in the grab() function. We need to pass the coordinates in the form of a tuple. import pyscreenshot image=pyscreenshot.grab(bbox=(10,10,500, 500)) image.show() # To view the screenshot image.save(“screenshot1.png“) Example
  • 26. For more presentation in any subject please contact us raginijain0208@gmail.com