I need to generate PNG images of Latin characters and AMS symbols with transparent background. Each image should be exactly in dimensions of its box. I know It's possible with LaTeX because I see online LaTeX formula editors can generate such pictures. Currently I can generate only dvi and pdf files in known paper sizes (a4,letter ...). size of output must be bounded to its content and output must be in png format with transparent background.
I wish do this using a program. because there are thousands of characters and symbols that I need their LaTeX-produced images. Please tell me if there are CLI solutions or not. Also some of characters can only produced by XeTeX and XeLaTeX (characters of non-latin scripts)