Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6843631
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T00:16:06+00:00 2026-05-27T00:16:06+00:00

I need to put some text over a PNG image in Python, I need

  • 0

I need to put some text over a PNG image in Python, I need to put another image too over the first one.

So I’ll have a base image (the same for every image created), a logo to put over it in the upper left corner, and a text all over the image (non-specific font, I just need to set the font size).

Could I use PIL, or another Library?

I searched over StackOverflow and Google too, but I could not find tips on how to do this.

Thanks.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T00:16:06+00:00Added an answer on May 27, 2026 at 12:16 am

    PIL can do it:

    from PIL import Image, ImageFont, ImageDraw
    font = ImageFont.truetype("/usr/share/fonts/dejavu/DejaVuSans.ttf", 25)
    img = Image.new("RGBA", (200,200), (120,20,20))
    draw = ImageDraw.Draw(img)
    draw.text((0,0), "This is a test", (255,255,0), font=font)
    img.save("a_test.png")
    

    The only error that can occur is not to find the font.
    In this case you must change the code line:

    font = ImageFont.truetype("/usr/share/fonts/dejavu/DejaVuSans.ttf",25)
    

    Source: http://python-catalin.blogspot.com/2010/06/add-text-on-image-with-pil-module.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need to put an image and text to WPF Ribbon Menu. I have
For various reasons, I need to put a (mostly) transparent <div> over some text.
I have some text which I need to put in an sqlite database. I
I have about 10million values that I need to put in some type of
I need for someone to be able to put some text into a page
I need to put some subtext in a Winforms C# labels .Text property. Is
I have some text which I need to translate into Japanese. Translate text, webpage,
I need to put some of the entities created via a.dbml Linq-To-Sql file into
I need to put a little project together for myself, and I need some
I'm creating some big files (DB exports) with Java and I need to put

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.