If you want to
- adapt to the background color in
emacs by using a transparent background,
- except when the user sets the
background color explicitly in the latex source,
I suggest you instead
- use the known emacs background
color in the dvipng call.
- Then the explicit \special will
override the command-line specification.
Transparent background was intended
for the math on the web, where math authors might have
little control over the background.
Nowadays I'd recommend Mathjax for
that purpose.