codebox / mosaic

Python script for creating photomosaic images
https://codebox.net/pages/photo-mosaic-image-maker
MIT License
537 stars 166 forks source link

MemoryError #11

Closed Vortetty closed 1 year ago

Vortetty commented 4 years ago

i seem to be getting a memory error:

Reading tiles from C:\Users\vorte\Desktop\16x\assets\minecraft\textures\block\...
Processed 907 tiles.
Processing main image...
Traceback (most recent call last):
  File "C:\Users\vorte\Desktop\findstuff\mosaic.py", line 234, in <module>
    mosaic(sys.argv[1], sys.argv[2])
  File "C:\Users\vorte\Desktop\findstuff\mosaic.py", line 226, in mosaic
    image_data = TargetImage(img_path).get_data()
  File "C:\Users\vorte\Desktop\findstuff\mosaic.py", line 70, in get_data
    large_img = img.resize((w, h), Image.ANTIALIAS)
  File "C:\Users\vorte\AppData\Local\Programs\Python\Python38-32\lib\site-packages\PIL\Image.py", line 1873, in resize
    return self._new(self.im.resize(size, resample, box))
MemoryError

what would be causing this? my config is:

# Change these 3 config parameters to suit your needs...
TILE_SIZE = 16  # height/width of mosaic tiles in pixels
TILE_MATCH_RES = 8  # tile matching resolution (higher values give better fit but require more processing)
ENLARGEMENT = 16  # the mosaic image will be this many times wider and taller than the original

the input file is 256*256 and all of the tiles are 16x16. any idea how i can fix this, i have 16gb of memory so i dont see why this is a huge problem. all of the 907 images are 2.35 MB, and the largest of the files is around 50kb. the program also has just under 11gb to work with.