mirror of https://github.com/kivy/kivy.git
Merge pull request #1841 from ykmm/atlas-toomanyfiles-fix
Avoids the "Too many open files" error in case of a large number of inpu...
This commit is contained in:
commit
e797134913
|
@ -254,7 +254,13 @@ class Atlas(EventDispatcher):
|
|||
size_w = size_h = int(size)
|
||||
|
||||
# open all of the images
|
||||
ims = [(f, Image.open(f)) for f in filenames]
|
||||
ims = list()
|
||||
for f in filenames:
|
||||
fp = open(f)
|
||||
im = Image.open(fp)
|
||||
im.load()
|
||||
fp.close()
|
||||
ims.append((f, im))
|
||||
|
||||
# sort by image area
|
||||
ims = sorted(ims, key=lambda im: im[1].size[0] * im[1].size[1],
|
||||
|
|
Loading…
Reference in New Issue