My LyX version is 2.2.1,
If you check the codes of lyxpreview2bitmap.py,
it has its options:
> --dpi=<res>: Resolution per inch (default: 128) --png, --ppm:
> Select the output format (default: png) --fg=<color>: Foreground
> color (default: black, ie '000000') --bg=<color>: Background color
> (default: white, ie 'ffffff') --latex=<exe>: Specify the executable
> for latex (default: latex) --bibtex=<exe>: Specify the executable
> for bibtex (default: bibtex) --lilypond: Preprocess through
> lilypond-book (default: false) --lilypond-book=<exe>:
> The executable for lilypond-book (default: lilypond-book)
>
> -d, --debug: Show the output from external commands -h, --help:
> Show this help screen and exit -v, --verbose: Show progress messages
>
> The colors are hexadecimal strings, eg 'faf0e6'."""
Like @nbubis showed, we can click "modify" button for "LyX Preview -> PNG",
which can be found by searching "lyxpreview2bitmap" in LyX: Preferences.
another example can be:
python -tt $$s/scripts/lyxpreview2bitmap.py --png --fg="3f38cf" --bg="faf0e6"
preview
is descriptive enough :) from here, we can look at CTAN's listing.lyxpreview2bitmap.py
that is (I think) in/usr/share/lyx/scripts/
. I haven't looked too closely at the script yet, but perhaps you can figure it out. (If this is helpful I can add a proper answer.)