Fix JPG image rendering.

To pass QString as a const char* we should call <QString>.toLocal8Bit().constData().

Fixes #12684