Home > OS >  Make a frame to an image in python
Make a frame to an image in python

Time:06-07

Images are represented as matrices. Is there a practical way to make sort of frame around the content of the image? (in a monoton color)

CodePudding user response:

Theres a lot of ways to do that. I think the easiest way is just to add an image with everything transparent except for the borders and then draw it on top of the screen every frame.

CodePudding user response:

Like Miguel Pereira says, the easiest way is paste a frame previously made in the image that you want set the frame. You can use PIL like this.

from PIL import Image

img_frame = Image.open("frame_name.png")
img_bg = Image.open("bg_name.png")

img_bg.paste(img_frame, (cord_x, cord_y))

img_bg.show()

You may need to resize one of the images to fit

  • Related