Update app.py
Browse files43 unmodified lines44454647484950515243 unmodified linesrow = i // colscol = i % cols# Randomly shift images around (random placements)x_pos = random.randint(x_offset, collage_width - img.width)y_pos = random.randint(y_offset, collage_height - img.height)collage.paste(img, (x_pos, y_pos))43 unmodified lines44454647484950515243 unmodified linesrow = i // colscol = i % cols# Ensure the random range is valid by checking image dimensionsx_pos = random.randint(x_offset, collage_width - img.width) if collage_width - img.width > x_offset else x_offsety_pos = random.randint(y_offset, collage_height - img.height) if collage_height - img.height > y_offset else y_offsetcollage.paste(img, (x_pos, y_pos))
app.py+3-3