Skip to content Skip to sidebar Skip to footer

Label On Top Of Image In Python

I am trying to display text on top of an image. Right now the text is below the image or if I put a row=0 in the grid disappears. I am assuming it is behind the image. I can't seem

Solution 1:

You can do this by adding the text option to the label with your photo in. Then look at the compound feature to format it. It would look like this:

label=Label(image=image, text="Text", compound="center")

Solution 2:

In the below code the orgin postion is set to (0,0) it belong to the top left corner

import cv2
font = cv2.FONT_HERSHEY_SIMPLEX
orgin = (0, 0) 
fontScale = 1
color = (255, 0, 0) 
thickness = 2
image = cv2.putText(image, 'OpenCV', orgin, font,  
               fontScale, color, thickness, cv2.LINE_AA) 

Post a Comment for "Label On Top Of Image In Python"