This script creates high-quality image quotes, perfect for Instagram/Pinterest
in less than 5 seconds per 100+ images!
![](https://private-user-images.githubusercontent.com/52662032/270194594-526f7676-829f-4b77-aedd-cba775a95ab5.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5ODU0NDEsIm5iZiI6MTcyMzk4NTE0MSwicGF0aCI6Ii81MjY2MjAzMi8yNzAxOTQ1OTQtNTI2Zjc2NzYtODI5Zi00Yjc3LWFlZGQtY2JhNzc1YTk1YWI1LmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDEyNDU0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTU3MjJmOTNmMDM3OWE1MTkzMGEwNWFmZDZhMGE2OTFmMmQ3ZmFhYzFkZjM5YjhmMTMzMzc5NTBhNTQyOWIzYzcmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.bpljzF2r0fKysgmje4YCnRWeJGp39yNXgIcCsgK122o)
![](https://private-user-images.githubusercontent.com/52662032/270194633-1bfadae8-15ec-4b43-ad4d-209e24ddfbb6.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5ODU0NDEsIm5iZiI6MTcyMzk4NTE0MSwicGF0aCI6Ii81MjY2MjAzMi8yNzAxOTQ2MzMtMWJmYWRhZTgtMTVlYy00YjQzLWFkNGQtMjA5ZTI0ZGRmYmI2LnBuZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDEyNDU0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTBlMmE1ZjBiNmE4MzZhM2MzODJjMDcwNDBjYzgxMDRkYmUxODcwYTE3ZWQ5YzlkNjZjMDI0OWJhNTg5NzYwMGEmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.PSe8_ly-Dc0s5f0T0Be9qy2UVJ0ySiDym63aZ8ulZUc)
This is one of my first Python projects, hope you get the most out of it :)
I used it to sell Fitness and Christian quotes on Fiverr for a while.
After choosing the topics I wanted, I got a list of quotes and a stock of 50+ background images - both related to the picked topic.After getting enough images, I run those 2 functions:
helper.cut_images_new(): to crop the images to the desired dimensions.
helper.darken_images(): to darken the images so the text looks better.
The script works by taking a background image from '/sources/images/{topic}' and a quote from the .txt file, and combining them into 1 photo.I am using PILLOW to generate the text in different fonts and combine it with the background image.
All the images are copyright-free from stock footage websites, and the fonts are copyright-free as well.
Follow the instructions given below to get this script up and running on your device.
- Download this repository as zip file / using git.
- Open the folder.
- Make sure all the required modules are installed. (
pip install -r requirements.txt
) - Open main.py
- set the number of posts you want, your logo, and choose a topic (It can be one of the available topics, or you can add another one, how to is explained here)
TOPIC = "fitness"
SHOW_AUTHOR = True
CUSTOMER_NAME = "your_name"
NUM_OF_POSTS = 35
- RUN!
- And that's it! In about 5 seconds, you will have 100+ generated images!
- You can find your images in the
generated/your_name/
directory.
- Christian
- Fitness
To create a new topic, please follow these steps:
- Create a {topic}.txt file inside /sources/text_data
- Run "helper.create_new_topic_dirs(TOPIC, project_dir)" to auto create all the directories needed
- Add images to /sources/images/{topic}
- Run "helper.cut_images_new(images_folder, images_folder_cropped)" to crop the images to 1080 X 1350 (you can change the dimension inside the function)
- Run "helper.darken_images(images_folder_cropped, images_folder_cropped_darken)" if you want to make the images darker (it makes the text look better)
ANS THAT'S IT! :) Feel free to create a Pull Request if you want to help others as well!
PILLOW - For generating text images
After running the script you will get:
- The edited images.
![](https://private-user-images.githubusercontent.com/52662032/270194193-06119ee9-3b64-4a43-8305-5ff686187a41.jpg?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MjM5ODU0NDEsIm5iZiI6MTcyMzk4NTE0MSwicGF0aCI6Ii81MjY2MjAzMi8yNzAxOTQxOTMtMDYxMTllZTktM2I2NC00YTQzLTgzMDUtNWZmNjg2MTg3YTQxLmpwZz9YLUFtei1BbGdvcml0aG09QVdTNC1ITUFDLVNIQTI1NiZYLUFtei1DcmVkZW50aWFsPUFLSUFWQ09EWUxTQTUzUFFLNFpBJTJGMjAyNDA4MTglMkZ1cy1lYXN0LTElMkZzMyUyRmF3czRfcmVxdWVzdCZYLUFtei1EYXRlPTIwMjQwODE4VDEyNDU0MVomWC1BbXotRXhwaXJlcz0zMDAmWC1BbXotU2lnbmF0dXJlPTNiNzRkMTQ5Y2Y0ODI3YjMwNzgyMWQ1NWJkY2VmODI1NzQzZTFmMmEyZmYzMzllYzhkODMyNmEzZDhiYTE5NjUmWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.12PR--K3r3mDq0FVIndBa5UYAWtFVuJ9-ug3n2M1-4g)
![](https://private-user-images.githubusercontent.com/52662032/270194174-95eea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DZlYmE4YTUyMDhmYTYxMWImWC1BbXotU2lnbmVkSGVhZGVycz1ob3N0JmFjdG9yX2lkPTAma2V5X2lkPTAmcmVwb19pZD0wIn0.deoYFQv_herqTN9wvTkhSSt1h0pHm-Hv00fX7cg6BtY)
- A spreadsheet containing the file names, quotes, and authors, to make it easier to find the image you want.
Note that this script is very basic as of now. If you want to contribute, you are free to do so and you may even fork and improve this repository.