plugin.go 370 B

12345678910111213141516171819
  1. package main
  2. import "image"
  3. var Priority int = 1
  4. // Convert to grayscale image
  5. func Transform(src image.Image) image.Image {
  6. bounds := src.Bounds()
  7. w, h := bounds.Max.X, bounds.Max.Y
  8. ret := image.NewGray(image.Rectangle{image.Point{0, 0}, image.Point{w, h}})
  9. for x := 0; x < w; x++ {
  10. for y := 0; y < h; y++ {
  11. ret.Set(x, y, src.At(x, y))
  12. }
  13. }
  14. return ret
  15. }