This Python script utilizes the PIL (Python Imaging Library) module
to generate an image composed of squares, with each square representing a character from a user-provided input string. The colours of the squares are determined by randomly generated RGB colour codes.
- Python 3.x
- Pillow package (can be installed via pip:
pip install Pillow
orpip3 install Pillow
on UNIX based systems such as macOS)
- Ensure that
sorted_chars.json
is in the same directory as the script. You can usecolour generator.py
to create a new set of colours. - Run the script in the terminal or command prompt:
python main.py
- Input the desired width and height (in pixels) of the output image when prompted.
- Enter the string you want to convert into an image when prompted.
- The resulting image will be saved as
output.png
in the same directory as the script.
- The script generates random RGB colour codes for characters in the input string.
- It then creates an image based on the input string and colour codes, with each character represented by a coloured square.
- The dimensions of the output image are specified by the user.
- The processing time for image generation is displayed upon completion.