This Python script generates random images with various shapes (circles, hexagons, rectangles, triangles, and letters) on a black background. The shapes are positioned randomly within the image, and their colors and transparency are also randomly assigned. The generated images can be used for creative purposes, testing, or any other application that requires random shape patterns.
- Generates images with random shapes, colors, and transparency.
- Supports different types of shapes, including circles, hexagons, rectangles, triangles, and letters.
- Avoids fully overlapping shapes to ensure clear and distinct patterns.
- Configurable settings for the number of images, image dimensions, number of shapes per image, and maximum transparent shapes.
Here are some examples of images generated using the script:
-
Clone the repository to your local machine:
git clone https://github.com/your-username/random-shapes-generator.git
-
Navigate to the project directory:
cd random-shapes-generator
-
Install the required dependencies (Pillow library):
pip install pillow
-
Open the script (
random_shapes_generator.py
) in your preferred Python environment. -
Configure the script by adjusting the settings in the "main" block:
num_images = 50 # Adjust the number of images as needed output_base_path = "random_shapes_a4_" width, height = 700, 700 num_shapes = 3 # Adjust the number of shapes per image as needed max_transparent_shapes = 1 # Adjust the maximum number of transparent shapes as needed
-
Run the script:
python random_shapes_generator.py
-
The generated images will be saved in the current directory with filenames like
random_shapes_a4_1.png
,random_shapes_a4_2.png
, etc.