```{index} single: set_mime_data (Cairo::Surface) ``` ```{index} single: Cairo::Surface::set_mime_data ``` # set_mime_data Attaches the original compressed form of an image to the surface, so that a backend able to embed it does so instead of re-encoding the pixels, and returns a status name. $image->set_mime_data(Cairo::Surface::MIME_TYPE_JPEG, $jpeg_bytes); `$mime_type` is one of the `Cairo::Surface::MIME_TYPE_*` constants. Ask `supports_mime_type` first, since a backend that cannot use the data simply ignores it. The scalar itself is retained, NOT copied, so do not modify `$data` after handing it over; the surface holds on to it until the surface goes away or other data replaces it. Needs cairo 1.10 or newer; on an older library the call dies saying so. Wraps `cairo_surface_set_mime_data`.