LoadFromImage

Load an image from an instance of image.Image . It is recommended to use the Load method to load an image.

Parameters

ParameterTypeDescription

img

image.Image

The instance of the types that implement the image.Image interface

Return Values

The instance of *imgo.Image .

Examples

package main

import (
    "github.com/fishtailstudio/imgo"
    "image/png"
    "os"
)

func main() {
    file, err := os.Open("gopher.png")
    if err != nil {
        panic(err)
    }
    defer file.Close()

    img, err := png.Decode(file)
    if err != nil {
        panic(err)
    }

    imgo.LoadFromImage(img).
        Save("out.png")
}

Last updated