Following the stream-based design, the Go image package decodes images from a stream. By connecting to a remote stream and reading the bytes from the request, we can easily render an image from a web server. The following code uses the Fyne canvas.NewImageFromImage() function to render a Go decoded image, which we've loaded from the https://golang.org/doc/gopher/frontpage.png URL using image.Decode():
package mainimport ( "image" _ "image/png" "io" "log" "net/http" "fyne.io/fyne" "fyne.io/fyne/app" "fyne.io/fyne/canvas")func readStream(url string) io.ReadCloser { res, err := http.Get(url) if err != nil || res.StatusCode != 200 { log.Fatal("Error reading URL", err) } return res.Body}func remoteImage(url string) image.Image { stream ...