I am working on converting a long latex document with lots of equations to the modi file format to be displayed on a Kindle. I am using SimpleTex4ht to convert the latex document to html and create png files for all the equations.
The problem is the png files are set with a transparent background which does not work on the Kindle. I need to remove the transparent background. I am using the following arguments with the command line version of ImageMagick
convert filein.png -channel RGB -fill White -opaque None +channel -alpha Off -colorspace Gray fileout.png
which does work but the quality is not very good.
Is there a way that the final image can look as if it were displayed on a white background but without the transparency? For example convert the alpha blending to a grey scale?
Original

After convert

Any help on improving the result is greatly appreciated.
LasCondes