Learn how you can become a Python programmer in just 12 weeks.

    We respect your privacy. Unsubscribe at anytime.

    Learn How to Add Text to an Image in Python – 4 Easy Steps

    Step 1: Install the Pillow library

    We need the Pillow library in order to manipulate images. It can be installed by using pip.

    pip install Pillow
    

    This enables us to use PIL (Python Imaging Library) library.

    Step 2: Download a font to use.

    You can browse fonts free to download from Google Font Library. In this example I use the Balsamic Sans.

    Place the download in the same folder as you want to work from.

    Step 3: Find an awesome picture

    I use Pexels to find free awesome pictures to use.

    And place that image in your same location.

    Step 4: Create you Python program to add your awesome text

    from PIL import Image, ImageDraw, ImageFont
    # Open the image (change name and location if needed)
    image = Image.open('pics/background.jpg')
    draw = ImageDraw.Draw(image)
    # Import the font(change name and location if needed, also change font size if needed)
    font = ImageFont.truetype('font/BalsamiqSans-Bold.ttf', size=200)
    black = 'rgb(0, 0, 0)'  # black color
    # Draw the text - change position if needed
    message = "This is great!"
    draw.text((1000, 200), message, fill=black, font=font)
    # Draw the text - change position if needed
    name = 'You are AWESOME!'
    draw.text((1100, 500), name, fill=black, font=font)
    image.save('greeting_card.png')
    

    Python Circle

    Do you know what the 5 key success factors every programmer must have?

    How is it possible that some people become programmer so fast?

    While others struggle for years and still fail.

    Not only do they learn python 10 times faster they solve complex problems with ease.

    What separates them from the rest?

    I identified these 5 success factors that every programmer must have to succeed:

    1. Collaboration: sharing your work with others and receiving help with any questions or challenges you may have.
    2. Networking: the ability to connect with the right people and leverage their knowledge, experience, and resources.
    3. Support: receive feedback on your work and ask questions without feeling intimidated or judged.
    4. Accountability: stay motivated and accountable to your learning goals by surrounding yourself with others who are also committed to learning Python.
    5. Feedback from the instructor: receiving feedback and support from an instructor with years of experience in the field.

    I know how important these success factors are for growth and progress in mastering Python.

    That is why I want to make them available to anyone struggling to learn or who just wants to improve faster.

    With the Python Circle community, you can take advantage of 5 key success factors every programmer must have.

    Python Circle
    Python Circle

    Be part of something bigger and join the Python Circle community.

    Leave a Comment