```{index} single: create_from_png (Cairo::ImageSurface) ``` ```{index} single: Cairo::ImageSurface::create_from_png ``` # create_from_png Reads a PNG file and returns its contents as a `Cairo::ImageSurface`. my $surface = Cairo::ImageSurface->create_from_png('logo.png'); A file that cannot be read or is not a PNG still yields a surface, but one whose `status` reports the error rather than `'success'`, so check it before drawing. Dies if the cairo installed on this machine was built without PNG support; `Cairo::HAS_PNG_FUNCTIONS` tells you in advance. Wraps `cairo_image_surface_create_from_png`.