prog.go:12: undefined: Image
you can see it at http://play.golang.org/p/wVPMCvg5hD
What am I doing wrong?
I am sure it must be a stupid question, image.Decode returns type Image, so I should be able to use it?
On Sep 20, 2012 7:32 PM, "Jai Kumar" <jaiva...@gmail.com> wrote:
>
> What am I doing wrong?
The mighty Gopher kills a kitten whenever an error is ignored.
-j
On Sep 21, 2012 1:32 AM, "Jai Kumar" <jaiva...@gmail.com> wrote:
>
> package main
> import "os"
> import "image"
you forgot to import _ "image/jpg", or you won't be able to decode jpeg picture.
>
> func main() {
> aImg, _ := os.Open("foo.jpg")
blindly ignoring the error is the sign of a very bad style (if not the worst)
> defer aImg.Close()
> decodedImg, _, _ := image.Decode(aImg)
> doSomething(decodedImg)
> }
>
> func doSomething(dImg Image) string {
should use image.Image instead of Image
--