So it's day 5 of 100 days of coding. Today I wanted to try something different. I want to add the day into my cover pic daily. Doing it manually would be boring. So I thought of automating it. So today we are gonna add the Number of the day I am working on into the image using Open CV
Today's Objectives
1) Create a python script that will automatically add the given day's text into image
import cv2
import os
x_and_y = (470, 340)
font_color = (255, 255, 255)
font_scale = 2
font = cv2.FONT_HERSHEY_SIMPLEX
output_folder = './'
date = input("Enter the date to be added ") # Get Date to be added from user
im = cv2.imread('data/100_days_image_template.jpeg', 1)
cv2.putText(im, 'Day {}'.format(date), x_and_y,
font, font_scale, font_color, 2)
cv2.imwrite(output_folder+date+".jpeg", im)
You can check the sample image in header
You can check the full code in my repo automated_python_Scripts
Top comments (0)