TextMosaic is a tool that transforms your images into mosaics made from text.
Ensure you have Python installed, then install PIL:
pip install PillowDownload the textmosaic.py script or clone this repo:
git clone https://github.com/fuseraft/textmosaic
cd textmosaicTo use this script from a terminal, navigate to the directory containing the script and execute the following command:
python textmosaic.py <input_path> "<text>" <font_path> <font_size> [--output <output>]input_path: Path to the image file you want to transform.text: The text string you wish to form the mosaic.font_path: Path to the.ttffont file for the text styling.font_size: Font size for the mosaic text.output(optional): Path to save the output image. If not provided, the image will be displayed directly.
To display the image directly:
python textmosaic.py images/input_003.jpg "hello world" fonts/FreeMono.ttf 20To save the output to a file:
python textmosaic.py images/input_003.jpg "fuseraft" fonts/FreeMono.ttf 20 --output examples/output.pngExample output:
Contributions are welcome! Fork the repository and submit a pull request with your enhancements.
This project is open source and available under the MIT License.
