![]() Example of memory-usage optimization: load a frame, append it to the image list, and then delete that frame, and move onto the next one. Nevertheless, once you get to the final stage, the "image compilation" will take a ton of memory. ![]() If you can save some elements of the image to disk until the moment it is needed, that might reduce the memory drain. ![]() In-memory image handling is naturally very memory-intensive. Maybe not as optimized as more modern optimization routines, but better than raw bitmap data, nonetheless. GIF is normally compressed and otherwise optimized. Pillow images in memory are basically raw bitmap data with no compression. So the problem is that all these images are generated and stored in memory, I'm thinking one solution is to write them all to disk and then create the gif, but it seems like I'd still have to load them all back in to memory, so not sure if it would work. The image mode i'm using for the images is RBG. It used about 3 GB of data for a few hundred frames of simulation pictures, even though the GIF after creation is only 2 MB, which i'm guessing is either due to data compression making the gif smaller or memory leak making the program use more memory than intended. I'm not sure if it is a memory leak but it's using a crazy amount of memory to do this. I then use Image.save() to save that GIF file appending all the images in the image array. ![]() ![]() The image is drawn in memory using Image.new() and ImageDraw, then an input is given to the simulation, and repeat until i have all the image frames needed to create a GIF. I'm currently using Pillow to generate a series of images from a simulator. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |