hanzhi713 / image-collage-maker

A photo mosaic (pixel collage) maker. Use all your friends' profile pictures to approximate your profile picture! 如何用 Python 制作一个炫酷的微信好友图
MIT License
150 stars 14 forks source link

BUG: GUI runs out of memory/needs mem_limit #13

Closed Pizzanomicon closed 2 years ago

Pizzanomicon commented 2 years ago

GUI fails to generate photomosaic, citing:

ERROR
Traceback (most recent call last):
 File "gui.py", line 556, in wrapper
 File "gui.py", line 543, in action
 File "make_img.py", line 589, in process_dest_img
 File "make_img.py", line 410, in __call__
 File "make_img.py", line 371, in _euclidean
numpy.core._exceptions._ArrayMemoryError: Unable to allocate 8.82 TiB for an array with shape (1557204, 1557204) and data type float 32

I can see why it wouldn't find space for a 8.82 TiB array- guessing a mem_limit variable in the GUI would prevent this?

hanzhi713 commented 2 years ago

How many tiles do you have and what's the resolution of your destination image?

Pizzanomicon commented 2 years ago

130,000 tiles and 1920x1292 destination image

hanzhi713 commented 2 years ago

130,000 tiles and 1920x1292 destination image

For photomosaics of this size, you cannot use the fair mode due to the memory complexity of that method. You need to use the unfair mode instead.