Convert a raw scalar data array to jpeg/webp