DEV Community

Cover image for Python Portfolio - Dynamic Invitation Image Generator
Tirth Patel
Tirth Patel

Posted on

Python Portfolio - Dynamic Invitation Image Generator

Whenever you are host of any event, sending invitations to your near & dear ones is major task. And sometimes tedious also if your guest count is big. 😣

Suppose, you plan to send a personalized invitation to each member that includes his/her name on it. This will need you a graphic designer who can sit all day long and can generate such personalized invitation posters with dynamic name on each. ⌨️

To solve your issue, I have made a tool in Python that leverages the power of OpenCV to implement image processing on a invitation poster. It can embed name (or any detail) on image and give you a separate poster for each invitee. 🕺


How to use the tool

Here is a simple outline which you can follow:

Let's take example of Birthday Invitation to understand the execution of this tool.
Source code : Github Repo Link


1) Providing necessary details:

You will have to give 2 details viz. invitation poster image (jpg/png/jpeg) and list of names (text file)

Sample birthday invitation poster:
(you need to put this image in code folder)

Sample Poster

List of invitee names:

Mr. Tirth Patel
Ms. Sneha Shah
Mr. Bhavesh Jain
Mr. Rahul Singh
Mr. Rushi Patel
Mrs. Kavita Ahuja
Enter fullscreen mode Exit fullscreen mode

2) Selecting location co-ordinates for where to put name.

  • You need select the location co-ordinates on the image at which you want to put the name of the invitee.

  • In the code folder, please open select_coordinate.py file and update the filename of invitation image which you are using.

  • Once you run it, double click on the image where you want to put the name. This can be trail & error excercise. Iterating this process 2-3 times will give you exact location you want.


3) Hurrah! Lets generate personalized invitation for all

  • Now we have image, names and co-ordinates where to put the name.
  • Open generate_invitation.py file and update the filename which you are going to use.
  • Execute this python script in your IDE and you can see, personalized invitation is generated for all the invitees. (check the outputs folder)

Invitation Collage

Scope of this tool 🚀

  • As of now, this tool only supports name on an Invitation poster. But the core concept is image processing. You can use it for multiple use cases. Like certificate generation, name tag generation, ID card generator and many more.
  • Due to time constraints, I have limited the development scope to Python only. If you need some web app for this, please ping me in comment section.
  • After Invitation generation, sending these personalized invitation is also a mammoth task. If you need to send them in Whatsapp, we can use Whatsapp API provided by Facebook to automate the generation and sending process. If your use case is to send on email, we can utilize Python or any such framework to send emails with the generated output.

Closing comments 🙋‍♂️

  • Thank you for reading along with me. If you find any queries on the topic mentioned above, please ping me in the comments. 💬
  • Knowledge spreads by sharing. So please share this article with your concerned friends. 📱
  • PS: Also, I humbly request you to write which topic you want in my next blog. I will include that in my target list. 🎯

Tirth Patel, signing off!🫡

Top comments (0)