Hi,
It is possible to resize this image to 500 wide x 400 pixels? See code below
package main
import (
"image"
"image/color"
"image/draw"
"image/png"
"os"
)
var (
white color.Color = color.RGBA{255, 255, 255, 255}
black color.Color = color.RGBA{0, 0, 0, 255}
blue color.Color = color.RGBA{0, 0, 255, 255}
grey color.Color = color.RGBA{150, 150, 150, 255}
)
// reference => http://golang.org/doc/articles/image_draw.html
func main() {
m := image.NewRGBA(image.Rect(0, 0, 640, 480))
// fill m in grey
draw.Draw(m, m.Bounds(), &image.Uniform{grey}, image.ZP, draw.Src)
// draw a line
for i := m.Bounds().Min.X; i < m.Bounds().Max.X; i++ {
m.Set(i, m.Bounds().Max.Y/2, white)
m.Set(i, m.Bounds().Max.Y/3, black)
m.Set(i/2, m.Bounds().Max.Y/4, blue)
}
w, _ := os.Create("new.png")
defer w.Close()
png.Encode(w, m)
}