It turns out AsJPEG (like AsPNG) are not thread-safe and must be executed from the main/UI thread. Fix bug #11583