Move UI-less export_image faking into actual XS function.
Handle alpha channel right.
Convert to indexed if GIF and export_image doesn't do.