DDA Line Algorithm using python language:
from PIL import Image as img
def PixelIn(x,y,im):
im.putpixel((x,y),0)
def ROUND(a):
return int(a + 0.5)
def DDALine(x1,y1, x2, y2):
im = img.new(mode='1', size=(1000, 1000), color=1)
x, y = x1, y1
length = abs((x2 - x1) if abs(x2 - x1) > abs(y2 - y1) else (y2 - y1))
dx = (x2 - x1) / float(length)
dy = (y2 - y1) / float(length)
for i in range(length):
PixelIn(ROUND(x),ROUND(y),im)
x += dx
y += dy
im.save('DDA Output.png')
im.show()
if __name__=='__main__':
DDALine(100,500,700,700)
Output Image: