Gtk.Image.new_from_resource

function new_from_resource(resource_path:String):Gtk.Widget {
    // Gjs wrapper for gtk_image_new_from_resource()
}

Creates a new Gtk.Image displaying the resource file resource_path. If the file isn't found or can't be loaded, the resulting Gtk.Image will display a "broken image" icon. This function never returns null, it always returns a valid Gtk.Image widget.

If the file contains an animation, the image will contain an animation.

If you need to detect failures to load the file, use GdkPixbuf.new_from_file to load the file yourself, then create the Gtk.Image from the pixbuf. (Or for animations, use GdkPixbuf.new_from_file).

The storage type (Gtk.Image.prototype.get_storage_type) of the returned image is not defined, it will be whatever is appropriate for displaying the file.

Since 3.4

resource_path

a resource path

Returns

a new Gtk.Image