René's URL Explorer Experiment


Title: Creating Animations With NumPy (Video) – Real Python

Open Graph Title: Creating Animations With NumPy – Real Python

Description: Using NumPy to Create Animations. In the previous section of the course, you created a color image containing three overlapping squares of different colors. In this section of the course, you’ll create an animation showing those three squares…

Open Graph Description: Using NumPy to Create Animations. In the previous section of the course, you created a color image containing three overlapping squares of different colors. In this section of the course, you’ll create an animation showing those three squares…

Opengraph URL: https://realpython.com/lessons/python-pillow-numpy-animate/

X: @realpython

direct link

Domain: realpython.com


Hey, it has json ld scripts:
  {
    "@context": "https://schema.org",
    "@type": "VideoObject",
    "name": "Creating Animations With NumPy",
    "description": "Using NumPy to Create Animations. In the previous section of the course, you created a color image containing three overlapping squares of different colors. In this section of the course, you’ll create an animation showing those three squares…",
    "thumbnailUrl": ["https://files.realpython.com/media/Image-Processing-in-Python-With-Pillow_Watermarked.b86d7e55f981.jpg"],
    "uploadDate": "2023-08-15T14:00:00+00:00",
    "duration": "PT3M14S",
    
    "potentialAction": {
      "@type": "SeekToAction",
      "target": "https://realpython.com/lessons/python-pillow-numpy-animate/#t={seek_to_second_number}",
      "startOffset-input": "required name=seek_to_second_number"
    }
  }
  

authorReal Python
twitter:cardsummary_large_image
twitter:imagehttps://files.realpython.com/media/Image-Processing-in-Python-With-Pillow_Watermarked.b86d7e55f981.jpg
og:imagehttps://files.realpython.com/media/Image-Processing-in-Python-With-Pillow_Watermarked.b86d7e55f981.jpg
twitter:creator@realpython
og:typevideo.episode

Links:

https://realpython.com/
Start Herehttps://realpython.com/start-here/
Learn Python https://realpython.com/lessons/python-pillow-numpy-animate/
Python Tutorials →In-depth articles and video courseshttps://realpython.com/search?kind=article&kind=course&order=newest
Learning Paths →Guided study plans for accelerated learninghttps://realpython.com/learning-paths/
Quizzes & Exercises →Check your learning progresshttps://realpython.com/quizzes/
Browse Topics →Focus on a specific area or skill levelhttps://realpython.com/tutorials/all/
Community Chat →Learn with other Pythonistashttps://realpython.com/community/
Office Hours →Live Q&A calls with Python expertshttps://realpython.com/office-hours/
Podcast →Hear what’s new in the world of Pythonhttps://realpython.com/podcasts/rpp/
Books →Round out your knowledge and learn offlinehttps://realpython.com/products/books/
Reference →Concise definitions for common Python termshttps://realpython.com/ref/
Code Mentor →BetaPersonalized code assistance & learning toolshttps://realpython.com/mentor/
Unlock All Content →https://realpython.com/account/join/
More https://realpython.com/lessons/python-pillow-numpy-animate/
Learner Storieshttps://realpython.com/learner-stories/
Python Newsletterhttps://realpython.com/newsletter/
Python Job Boardhttps://www.pythonjobshq.com
Meet the Teamhttps://realpython.com/team/
Become a Tutorial Writerhttps://realpython.com/write-for-us/
Become a Video Instructorhttps://realpython.com/become-an-instructor/
Searchhttps://realpython.com/search
https://realpython.com/search
Joinhttps://realpython.com/account/join/
Sign‑Inhttps://realpython.com/account/login/?next=%2Flessons%2Fpython-pillow-numpy-animate%2F
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-pillow
Unlock This Lessonhttps://realpython.com/account/join/?utm_source=rp_lesson&utm_content=python-pillow
https://realpython.com/courses/python-pillow/#team
Process Images Using the Pillow Library and Pythonhttps://realpython.com/courses/python-pillow/
Darren Joneshttps://realpython.com/courses/python-pillow/#team
Recommended Tutorialhttps://realpython.com/image-processing-with-the-python-pillow-library/
Course Slides (.pdf)https://realpython.com/courses/python-pillow/downloads/python-pillow-slides/
Sample Code (.zip)https://realpython.com/courses/python-pillow/downloads/python-pillow-code/
Ask a Questionhttps://realpython.com/lessons/python-pillow-numpy-animate/#discussion
https://realpython.com/feedback/survey/course/python-pillow/liked/?from=lesson-title
https://realpython.com/feedback/survey/course/python-pillow/disliked/?from=lesson-title
Transcripthttps://realpython.com/lessons/python-pillow-numpy-animate/#transcript
Discussionhttps://realpython.com/lessons/python-pillow-numpy-animate/#discussion
00:00https://realpython.com/lessons/python-pillow-numpy-animate/#t=0.47
Using NumPy to Create Animations. In the previous section of the course,https://realpython.com/lessons/python-pillow-numpy-animate/#t=0.47
you created a color image containing three overlapping squares of differenthttps://realpython.com/lessons/python-pillow-numpy-animate/#t=5.33
colors. In this section of the course,https://realpython.com/lessons/python-pillow-numpy-animate/#t=9.23
you’ll create an animation showing those three squares merging into a singlehttps://realpython.com/lessons/python-pillow-numpy-animate/#t=11.53
white square.https://realpython.com/lessons/python-pillow-numpy-animate/#t=15.44
00:16https://realpython.com/lessons/python-pillow-numpy-animate/#t=16.83
You’ll create several versions of the images containing the squares,https://realpython.com/lessons/python-pillow-numpy-animate/#t=16.83
and the location of the squares will vary between successive images.https://realpython.com/lessons/python-pillow-numpy-animate/#t=20.03
00:28https://realpython.com/lessons/python-pillow-numpy-animate/#t=28.39
You create an empty list called square_animation,https://realpython.com/lessons/python-pillow-numpy-animate/#t=28.39
which you’ll use to store the images you generate.https://realpython.com/lessons/python-pillow-numpy-animate/#t=30.78
00:36https://realpython.com/lessons/python-pillow-numpy-animate/#t=36.91
Within the for loop, you create NumPy arrays for the red, green,https://realpython.com/lessons/python-pillow-numpy-animate/#t=36.91
and blue channels, as you did in the previous section.https://realpython.com/lessons/python-pillow-numpy-animate/#t=40.79
00:48https://realpython.com/lessons/python-pillow-numpy-animate/#t=48.12
The red square starts in a position displaced to the top left of the center.https://realpython.com/lessons/python-pillow-numpy-animate/#t=48.12
In each successive frame,https://realpython.com/lessons/python-pillow-numpy-animate/#t=52.76
the red square moves closer to the center until it reaches it in the finalhttps://realpython.com/lessons/python-pillow-numpy-animate/#t=54.2
iteration of the loop.https://realpython.com/lessons/python-pillow-numpy-animate/#t=58.14
01:00https://realpython.com/lessons/python-pillow-numpy-animate/#t=60.21
The array containing the green layer is always the same and represents a squarehttps://realpython.com/lessons/python-pillow-numpy-animate/#t=60.21
in the center of the image.https://realpython.com/lessons/python-pillow-numpy-animate/#t=64.17
The blue square is initially shifted towards the bottom right and moves towardshttps://realpython.com/lessons/python-pillow-numpy-animate/#t=67.18
the center in a similar way.https://realpython.com/lessons/python-pillow-numpy-animate/#t=71.28
01:15https://realpython.com/lessons/python-pillow-numpy-animate/#t=75.17
Note that in this example, you’re iterating over the range(0, 102, 2),https://realpython.com/lessons/python-pillow-numpy-animate/#t=75.17
which means that the variable offset increases in steps of two.https://realpython.com/lessons/python-pillow-numpy-animate/#t=79.87
01:24https://realpython.com/lessons/python-pillow-numpy-animate/#t=84.5
Each of the red, green,https://realpython.com/lessons/python-pillow-numpy-animate/#t=84.5
and blue images is created separately as a grayscale image,https://realpython.com/lessons/python-pillow-numpy-animate/#t=85.83
and while they’re named after each color,https://realpython.com/lessons/python-pillow-numpy-animate/#t=89.53
there isn’t any color information actually present in the images at this point.https://realpython.com/lessons/python-pillow-numpy-animate/#t=91.36
01:40https://realpython.com/lessons/python-pillow-numpy-animate/#t=100.12
The animation now has a new frame appended to it,https://realpython.com/lessons/python-pillow-numpy-animate/#t=100.12
consisting of a merge of the three images in the red, green, and blue channels.https://realpython.com/lessons/python-pillow-numpy-animate/#t=102.75
This is where the color is created.https://realpython.com/lessons/python-pillow-numpy-animate/#t=107.69
01:58https://realpython.com/lessons/python-pillow-numpy-animate/#t=118.83
You learned earlier on that you can save an Image object to a filehttps://realpython.com/lessons/python-pillow-numpy-animate/#t=118.83
using Image.save().https://realpython.com/lessons/python-pillow-numpy-animate/#t=122.06
You can use the same function to save a GIF file that includes a sequence ofhttps://realpython.com/lessons/python-pillow-numpy-animate/#t=124.27
images. You call Image.save() on the first image in the sequence,https://realpython.com/lessons/python-pillow-numpy-animate/#t=128.25
which is the first image that you stored in the list square_animation.https://realpython.com/lessons/python-pillow-numpy-animate/#t=133.04
02:17https://realpython.com/lessons/python-pillow-numpy-animate/#t=137.29
The first argument in .save() is the filename for the file that you want to save.https://realpython.com/lessons/python-pillow-numpy-animate/#t=137.29
The extension in the filename tells .save() which file format it needs to output.https://realpython.com/lessons/python-pillow-numpy-animate/#t=142.4
02:27https://realpython.com/lessons/python-pillow-numpy-animate/#t=147.69
You also include two keyword arguments in .save().https://realpython.com/lessons/python-pillow-numpy-animate/#t=147.69
save_all=True ensures that all the images in the sequence are saved and nothttps://realpython.com/lessons/python-pillow-numpy-animate/#t=152.31
just the first one.https://realpython.com/lessons/python-pillow-numpy-animate/#t=156.53
02:38https://realpython.com/lessons/python-pillow-numpy-animate/#t=158.87
append_images allows you to append the remaining images in the sequence to thehttps://realpython.com/lessons/python-pillow-numpy-animate/#t=158.87
file. Once the file is saved, which may take some timehttps://realpython.com/lessons/python-pillow-numpy-animate/#t=162.93
depending on your system, you can open it with any image software.https://realpython.com/lessons/python-pillow-numpy-animate/#t=167.75
02:52https://realpython.com/lessons/python-pillow-numpy-animate/#t=172.1
The image should loop by default, but on some systems,https://realpython.com/lessons/python-pillow-numpy-animate/#t=172.1
you’ll need to add the keyword argument loop=0 to .save()https://realpython.com/lessons/python-pillow-numpy-animate/#t=174.78
to make sure that it does. Now that you’ve seen what to do,https://realpython.com/lessons/python-pillow-numpy-animate/#t=178.86
you can experiment by trying to create your own animation using different shapeshttps://realpython.com/lessons/python-pillow-numpy-animate/#t=183.22
and different colors. But in the next section of the course,https://realpython.com/lessons/python-pillow-numpy-animate/#t=187.1
you’ll take a look back at what you’ve learned.https://realpython.com/lessons/python-pillow-numpy-animate/#t=190.46
Become a Memberhttps://realpython.com/account/join/
https://realpython.com/lessons/python-numpy-create-image/
Overviewhttps://realpython.com/courses/python-pillow/
https://realpython.com/lessons/python-pillow-summary/
Process Images Using the Pillow Library and Python (Overview) 01:59 https://realpython.com/videos/python-pillow-overview/
Basic Image Operations 07:51 https://realpython.com/videos/python-pillow-operations/
Basic Manipulations 02:42 https://realpython.com/videos/python-pillow-manipulations/
Bands and Modes of an Image 05:25 https://realpython.com/lessons/python-pillow-bands-modes/
Image Processing 04:39 https://realpython.com/lessons/python-pillow-image-processing/
Blurring, Sharpening, and Smoothing 04:31 https://realpython.com/lessons/python-pillow-blur-sharpen-smooth/
Edge Detection, Enhancement, and Embossing 03:05 https://realpython.com/lessons/python-pillow-edge-enhance-emboss/
Segmentation and Superimposition 05:36 https://realpython.com/lessons/python-pillow-segment-superimpose/
Erosion and Dilation 04:18 https://realpython.com/lessons/python-pillow-erode-dilate/
Image Segmentation 03:38 https://realpython.com/lessons/python-pillow-segmentation/
Superimposition of Images 04:55 https://realpython.com/lessons/python-pillow-superimpose-images/
Using NumPy With Pillow 03:19 https://realpython.com/lessons/python-numpy-pillow/
Creating Images With NumPy 03:09 https://realpython.com/lessons/python-numpy-create-image/
Creating Animations With NumPy 03:14 https://realpython.com/lessons/python-pillow-numpy-animate/
Process Images Using the Pillow Library and Python (Summary) 00:47 https://realpython.com/lessons/python-pillow-summary/
Privacy Policyhttps://realpython.com/privacy-policy/

Viewport: width=device-width, initial-scale=1, shrink-to-fit=no, viewport-fit=cover

Robots: max-image-preview:large


URLs of crawlers that visited me.