From 0957fedaee7c1a0a480f1e65d7a85032d0211b1d Mon Sep 17 00:00:00 2001 From: Antoni Sawicki Date: Sun, 26 Apr 2020 01:25:28 -0700 Subject: [PATCH] change image size from MB to KB --- wrp.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/wrp.go b/wrp.go index 149b4a1..6c6e6d2 100644 --- a/wrp.go +++ b/wrp.go @@ -352,7 +352,7 @@ func (w wrpReq) capture() { return } img[imgpath] = gifbuf - ssize = fmt.Sprintf("%.1f MB", float32(len(gifbuf.Bytes()))/1024.0/1024.0) + ssize = fmt.Sprintf("%.0f KB", float32(len(gifbuf.Bytes()))/1024.0) sw = i.Bounds().Max.X sh = i.Bounds().Max.Y log.Printf("%s Encoded GIF image: %s, Size: %s, Colors: %d, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, w.colors, sw, sh) @@ -360,7 +360,7 @@ func (w wrpReq) capture() { pngbuf := bytes.NewBuffer(pngcap) img[imgpath] = *pngbuf cfg, _, _ := image.DecodeConfig(pngbuf) - ssize = fmt.Sprintf("%.1f MB", float32(len(pngbuf.Bytes()))/1024.0/1024.0) + ssize = fmt.Sprintf("%.0f KB", float32(len(pngbuf.Bytes()))/1024.0) sw = cfg.Width sh = cfg.Height log.Printf("%s Got PNG image: %s, Size: %s, %dx%d\n", w.req.RemoteAddr, imgpath, ssize, sw, sh)