Skip to content

Instantly share code, notes, and snippets.

@esdrasbeleza
Last active August 29, 2015 14:20
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save esdrasbeleza/e805d7ee12e4997ca0cb to your computer and use it in GitHub Desktop.
Save esdrasbeleza/e805d7ee12e4997ca0cb to your computer and use it in GitHub Desktop.
type ImageContainer interface {
GetImage() image.Image
}
type FileImageContainer struct {
Filename string
}
func (f FileImageContainer) GetImage() image.Image {
file, _ := os.Open(f.filename)
defer file.Close()
image, _, _ := image.Decode(file)
return image
}
type ImageItselfContainer struct {
Image image.Image
}
func (i ImageItselfContainer) GetImage() image.Image {
return i.Image
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment