Guest User

Untitled

a guest
Nov 20th, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.75 KB | None | 0 0
  1. package main
  2.  
  3. import (
  4. "bytes"
  5. "io/ioutil"
  6. "fmt"
  7. "image/color"
  8. "image/png"
  9. )
  10.  
  11. import "github.com/harrydb/go/img/grayscale"
  12.  
  13. func main() {
  14.  
  15. FName_BG := "test.background.png";
  16. data_BG, _ := ioutil.ReadFile(FName_BG)
  17. img_BG, _ := png.Decode(bytes.NewReader(data_BG))
  18. grayImg_BG := grayscale.Convert(img_BG, grayscale.ToGrayLuminance)
  19.  
  20. MaxRowSize, MaxColSize := img_BG.Bounds().Max.Y, img_BG.Bounds().Max.X;
  21.  
  22. for y := 0; y < MaxRowSize; y++ {
  23. for x := 0; x < MaxColSize; x++ {
  24. c1_bg := grayImg_BG.At(x,y).(color.Gray);
  25. fmt.Println(c1_bg)
  26. }
  27. }
  28. }
  29.  
  30. {255}
  31. {255}
  32. {255}
  33. {255}
  34.  
  35. type Gray struct {
  36. Y uint8
  37. }
  38.  
  39. fmt.Println(c.Y)
Add Comment
Please, Sign In to add comment