How to rotate an image?
External Google graphics package used to rotate the image.
Example
package main
import (
"os"
"math"
"image"
"image/jpeg"
"code.google.com/p/graphics-go/graphics"
)
func main() {
imagePath, _ := os.Open("jellyfish.jpg")
defer imagePath.Close()
srcImage, _, _ := image.Decode(imagePath)
srcDim := srcImage.Bounds()
dstImage := image.NewRGBA(image.Rect(0, 0, srcDim.Dy(), srcDim.Dx()))
graphics.Rotate(dstImage, srcImage, &graphics.RotateOptions{math.Pi / 2.0})
newImage, _ := os.Create("newjellyfish.jpg")
defer newImage.Close()
jpeg.Encode(newImage, dstImage, &jpeg.Options{jpeg.DefaultQuality})
}