Image.newFromFile

gtk.image.Image newFromFile(string filename)

Creates a new [gtk.image.Image] displaying the file filename.

If the file isn’t found or can’t be loaded, the resulting [gtk.image.Image] will display a “broken image” icon. This function never returns null, it always returns a valid [gtk.image.Image] widget.

If you need to detect failures to load the file, use [gdk.texture.Texture.newFromFile] to load the file yourself, then create the [gtk.image.Image] from the texture.

The storage type (see [gtk.image.Image.getStorageType]) of the returned image is not defined, it will be whatever is appropriate for displaying the file.

Parameters

filenamea filename

Returns

a new [gtk.image.Image]