Reputation: 82
I am making a discord bot with discord.py. Currently, I'm working on a LaTeX printer with sympy.
I have the code:
@commands.command(name="latex",
aliases=["tex", "tx"])
async def texPrt(self, ctx, *, text):
Funcs.command_exec(ctx)
expre = sympify(text, evaluate=False)
preview(expre, viewer="file", filename="output.png")
await ctx.send(file=discord.File(f"./output.png", filename="LaTeX_output.png"))
This takes the equation that the user enters and outputs a png image:
The only issue is that the image that comes out is very small and low resolution. Is there a way to make it render the image larger and increase the font size.
Also if possible I would like to change the background colour to be similar to discord, but that's not the priority.
Upvotes: 1
Views: 1280
Reputation: 2413
Set the density parameter in dvioptions
:
preview(expr, viewer="file", filename="output.png", dvioptions=['-D','1200'])
Upvotes: 3