delete images after creating video
This commit is contained in:
parent
2d960c91b7
commit
5f2d3e890d
|
|
@ -18,6 +18,8 @@ length = .1
|
||||||
numberOfEvents = 3
|
numberOfEvents = 3
|
||||||
dirname = os.path.dirname(__file__)
|
dirname = os.path.dirname(__file__)
|
||||||
|
|
||||||
|
imageType = ".png"
|
||||||
|
|
||||||
imagesPath = os.path.join(dirname, 'images')+"/"
|
imagesPath = os.path.join(dirname, 'images')+"/"
|
||||||
outputPath = os.path.join(dirname, 'out.mp4')
|
outputPath = os.path.join(dirname, 'out.mp4')
|
||||||
|
|
||||||
|
|
@ -50,7 +52,7 @@ def genImages():
|
||||||
img1 = ImageDraw.Draw(img)
|
img1 = ImageDraw.Draw(img)
|
||||||
|
|
||||||
img1.rectangle(objectShape, fill = color)
|
img1.rectangle(objectShape, fill = color)
|
||||||
img.save( imagesPath + str(counter).zfill(6) + ".png")
|
img.save( imagesPath + str(counter).zfill(6) + imageType)
|
||||||
|
|
||||||
def makeVideo():
|
def makeVideo():
|
||||||
fileList = []
|
fileList = []
|
||||||
|
|
@ -64,5 +66,11 @@ def makeVideo():
|
||||||
writer.append_data(imageio.imread(im))
|
writer.append_data(imageio.imread(im))
|
||||||
writer.close()
|
writer.close()
|
||||||
|
|
||||||
|
def deleteImages():
|
||||||
|
filelist = glob.glob(os.path.join(imagesPath, "*" + imageType))
|
||||||
|
for f in filelist:
|
||||||
|
os.remove(f)
|
||||||
|
|
||||||
genImages()
|
genImages()
|
||||||
makeVideo()
|
makeVideo()
|
||||||
|
#deleteImages()
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue