func (cv *Canvas) LoadImage(src interface{}) (*Image, error) {
	var reload *Image
	if img, ok := src.(*Image); ok {
		if img.cv != cv {
			panic("image loaded with different canvas")
		}
		if img.deleted {
			reload = img
			src = img.src
		} else {
			img.lastUsed = time.Now()
			return img, nil
		}
	} else if _, ok := src.([]byte); !ok {
		if img, ok := cv.images[src]; ok {
			img.lastUsed = time.Now()
			return img, nil
		}
	}
	cv.reduceCache(Performance.CacheSize, 0)
	var srcImg image.Image
	switch v := src.(type) {
	case image.Image:
		srcImg = v
	case string:
		data, err := ioutil.ReadFile(v)
		if err != nil {
			return nil, err
		}
		srcImg, _, err = image.Decode(bytes.NewReader(data))
		if err != nil {
			return nil, err
		}
	case []byte:
		var err error
		srcImg, _, err = image.Decode(bytes.NewReader(v))
		if err != nil {
			return nil, err
		}
	case *Canvas:
		w, h := cv.b.Size()
		src = cv.GetImageData(0, 0, w, h)
	default:
		return nil, errors.New("Unsupported source type")
	}
	backendImg, err := cv.b.LoadImage(srcImg)
	if err != nil {
		return nil, err
	}
	cvimg := &Image{cv: cv, img: backendImg, lastUsed: time.Now(), src: src}
	if reload != nil {
		*reload = *cvimg
		return reload, nil
	}
	if _, ok := src.([]byte); !ok {
		cv.images[src] = cvimg
	}
	return cvimg, nil
}
LoadImage loads an image. The src parameter can be either an image from the
standard image package, a byte slice that will be loaded, or a file name
string. If you want the canvas package to load the image, make sure you
import the required format packages
package canvas
import (
	"bytes"
	"errors"
	"fmt"
	"image"
	"io/ioutil"
	"os"
	"strings"
	"time"
	"github.com/tfriedel6/canvas/backend/backendbase"
)
type Image struct {
	src      interface{}
	cv       *Canvas
	img      backendbase.Image
	deleted  bool
	lastUsed time.Time
}