Hi everyone,
Could anyone offer a way of reducing the memory usage of the code sample below? What I'm trying to do is create a timelapse mov file from a folder of images. The current version just does the basics of changing the image every frame, but when I try to export a mov file the memory usage gets so high that nodebox freezes completely. I get the impression that nodebox caches the image of every frame, so that very quickly it's using over 1GB of ram.
Apologies if the quality of the code below is not very good, I'm not very familiar with python yet.
Any suggestions greatly appreciated.
Al
importosclass ImageList:
def__init__(self, image_dir):
self.image_dir = image_dir
imgs = os.listdir(image_dir)self.imgs = [f for f in imgs if f.lower().endswith("jpg")]self.imgs.sort()self.img_num = 0defnext_image(self):
im = self.imgs[self.img_num]ifself.img_num == len(self.imgs)-1:
self.img_num = 0else:
self.img_num += 1returnself.image_dir + im
# ----------------------------------------size(1080, 720)speed(30)
ims = ImageList("/Users/al/Pictures/Timelapse/")defdraw():
im = ims.next_image()image(im, 0, 0, alpha=1.0)
high memory usage problem
Posted by Al on Nov 29, 2008Hi everyone,
Could anyone offer a way of reducing the memory usage of the code sample below? What I'm trying to do is create a timelapse mov file from a folder of images. The current version just does the basics of changing the image every frame, but when I try to export a mov file the memory usage gets so high that nodebox freezes completely. I get the impression that nodebox caches the image of every frame, so that very quickly it's using over 1GB of ram.
Apologies if the quality of the code below is not very good, I'm not very familiar with python yet.
Any suggestions greatly appreciated.
Al