You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
26 lines
533 B
Python
26 lines
533 B
Python
# Copyright (C) 2022 CVAT.ai Corporation
|
|
#
|
|
# SPDX-License-Identifier: MIT
|
|
|
|
from typing import List
|
|
from PIL import Image
|
|
from io import BytesIO
|
|
|
|
|
|
def generate_image_file(filename='image.png', size=(50, 50)):
|
|
f = BytesIO()
|
|
image = Image.new('RGB', size=size)
|
|
image.save(f, 'jpeg')
|
|
f.name = filename
|
|
f.seek(0)
|
|
|
|
return f
|
|
|
|
def generate_image_files(count) -> List[BytesIO]:
|
|
images = []
|
|
for i in range(count):
|
|
image = generate_image_file(f'{i}.jpeg')
|
|
images.append(image)
|
|
|
|
return images
|