From: AceVest Date: Mon, 20 Jan 2020 09:16:04 +0000 (+0800) Subject: ... X-Git-Url: http://zhaoyanbai.com/repos/icons/static/gitweb.css?a=commitdiff_plain;h=e8e3218f0fccded48811ba4337f235c23f0ad8f1;p=acecode.git ... --- diff --git a/tools/comm/bitpic.go b/tools/comm/bitpic.go index 8ec3475..11bf45c 100644 --- a/tools/comm/bitpic.go +++ b/tools/comm/bitpic.go @@ -7,91 +7,98 @@ * ------------------------------------------------------------------------ */ package main + import ( + "flag" "fmt" - "image" - "image/jpeg" - "os" - "log" - "image/color" + "image" + "image/color" + "image/jpeg" + "log" + "os" ) func getKey(x, y, divCntX, divCntY int) string { - xp := x / divCntX - yp := y / divCntY + xp := x / divCntX + yp := y / divCntY - s := fmt.Sprintf("%v_%v", xp, yp) + s := fmt.Sprintf("%v_%v", xp, yp) - return s + return s } func main() { defer fmt.Println("Program Exited...") - raw_pic_reader, err := os.Open("./a.jpg") - if err != nil { - log.Fatal(err) - } - defer raw_pic_reader.Close() - - m, _, err := image.Decode(raw_pic_reader) - if err != nil { - log.Fatalf("Decode: %v\n", err) - } - - - bounds := m.Bounds() - - img := image.NewRGBA(bounds) - - data := make(map[string][]color.Color) - - const divCntX = 12 - const divCntY = 12 - - for y := bounds.Min.Y; y