Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Interpolation and image drawing

In my little project I have a function that returns a list of points coordinates. Like this:

    points = [(x1, y1), (x2, y2),...]

When I draw it on image, I get points on image but I want continious line. How can I get it? And how to draw interpolated lines on an image?

like image 580
milssky Avatar asked Dec 11 '25 20:12

milssky


1 Answers

To draw lines, do the following:

import Image
import ImageDraw

im = Image.new('RGB',(500,500),(255,255,255))
draw = ImageDraw.Draw(im)
draw.line(points, fill=(255,0,0))
del draw 
im.save('output.jpg')

Once you understand the above code you'll be able to use the answers in this question to draw antialiased lines.

like image 85
carlosdc Avatar answered Dec 14 '25 15:12

carlosdc



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!