Answer the question
In order to leave comments, you need to log in
How to draw a dot on top of an Image by coordinates in Python?
Using the TCP / IP protocol, the Unity game server passed 2 variables, x and z, to the Python bot. (player coordinates)
Floats.
How can you draw the corresponding point on a png image using these 2 coordinates?
PS the maximum value for the X coordinate = 1015.635
and the maximum value for the Z coordinate = 1015.442
The picture is 1015 by 1015 pixels.
Answer the question
In order to leave comments, you need to log in
How to draw a dot on top of an Image by coordinates in Python?
pip install Pillow
from PIL import Image, ImageDraw
img = Image.open("1.png")
draw = ImageDraw.Draw(img)
draw.point((10, 10),fill='red') # Рисуем красную точку по координатам 10x10
img.show()
img.save('2.png')
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question