Save
Save the current image to a filesystem.
Parameters
Parameter
Type
Description
path
string
Path to the file where to write the image data. See Output as a file for supported formats.
quality
int
The quality of the image. Optional parameter. Only when the extension on path is jpg
or jpeg
, this parameter works. The valid range is (0, 100), and the default is 100.
Return Values
The instance of *imgo.Image
.
Examples
PNG
package main
import (
"github.com/fishtailstudio/imgo"
)
func main() {
imgo.Load("gopher.png").
Save("out.png")
}
JPEG
package main
import (
"github.com/fishtailstudio/imgo"
)
func main() {
imgo.Load("gopher.png").
Save("out.jpg")
}
package main
import (
"github.com/fishtailstudio/imgo"
)
func main() {
imgo.Load("gopher.png").
Save("out.jpg", 50) // 50 quality
}
BMP
package main
import (
"github.com/fishtailstudio/imgo"
)
func main() {
imgo.Load("gopher.png").
Save("out.bmp")
}
TIFF
package main
import (
"github.com/fishtailstudio/imgo"
)
func main() {
imgo.Load("gopher.png").
Save("out.tiff")
}
Last updated