2017-02-11 59 views
0

下面的代碼運行良好,除了一件事情。縮小圖像時,從原始圖像大小開始縮小,並縮小邊緣的黑色空間。動畫圖像幻燈片與移動相機

如何在沒有「黑色空間」的情況下實現縮小效果?

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) 

回答

0

您需要調整圖像,使其更大,那麼你需要(10%左右更大),那麼當你放大,仍有一些可用的圖像覆蓋黑色。