I want to save my latex equations as .png or image in python.
import sympy
x = sympy.symbols('x')
y = 1 + sympy.sin(sympy.sqrt(x**2 + 20))
lat = sympy.latex(y)
from PIL import Image, ImageDraw
W, H = (300,200)
im = Image.new("RGBA",(W,H),"yellow")
draw = ImageDraw.Draw(im)
w, h = draw.textsize(lat)
draw.text(((W-w)/2,(H-h)/2), r"$%s$" % lat, fill="black")
im.save(r'hello.png','PNG')
The output i am getting is not showing the latex equation