0

Code below works well except one thing. While zooming out it start from the original image size and scale it down so there is black space on the edges.

How to implement zooming out effect without "black space"?

from moviepy.editor import *

def zoomOut(t):
    return 1 - 0.03 * t  # Zoom-in.


def zoomIn(t):
    return 1 + 0.03 * t  # Zoom-in.

ImageClip(img_file)
            .resize(zoomIn) #.resize(zoomOut) 
            .set_position(('center', 'center'))
            .set_duration(2)

vid = concatenate(slides, method="compose")
vid.write_videofile('test.mp4', fps=24)
Alex T
  • 4,331
  • 3
  • 29
  • 47

1 Answers1

0

You will need to resize the image so that it is larger then you need (10% or so bigger), then when you zoom in, there is still some image available that covers the black.

Ken Cochrane
  • 75,357
  • 9
  • 52
  • 60