将image.Image转换为image.NRGBA

When I call png.Decode(imageFile) it returns a type image.Image. But I can't find a documented way to convert this to an image.NRGBA or image.RGBA on which I can call methods like At().

How can I achieve this?

If you don't need to "convert" the image type, and just want to extract the underlying type from the interface, use a "type assertion":

if img, ok := i.(*image.RGBA); ok {
    // img is now an *image.RGBA
}

Or with a type switch:

switch i := i.(type) {
case *image.RGBA:
    // i in an *image.RGBA
case *image.NRGBA:
    // i in an *image.NRBGA
}