From fe62cbd357dbbe12646bfb5565326373aa9f82c1 Mon Sep 17 00:00:00 2001 From: Hajime Hoshi Date: Wed, 21 Jan 2015 01:06:48 +0900 Subject: [PATCH] Reduce the size of keyboard.png --- .../example/images/keyboard/keyboard.png | Bin 3196 -> 2163 bytes example/images/keyboard/keyboard.png | Bin 3196 -> 2163 bytes example/keyboard/keyboard/gen.go | 9 ++++++++- 3 files changed, 8 insertions(+), 1 deletion(-) diff --git a/_docs/public/example/images/keyboard/keyboard.png b/_docs/public/example/images/keyboard/keyboard.png index dc3693760fc736f9649124d63431ca246b5dc7b0..70a76197893115bb80e54a84eb597df4bd76086a 100644 GIT binary patch literal 2163 zcmdT``8OMg7EWp@X>CKRV=tx{O3~1SG}c;1QFKkEi&pHR#8#rU8)~VoMZ`{}qFZ7~ zG}@u|S`)=lQz{X=1hK~R<_~!1y&vB%_xtWW_m}Ux_nvc8oE>e%Kyn}e03c>(Yvlp} z0L>2hs))d0yu`hH^ALoc9o(!B@!;T~atuFt$bca(j;;VR<~L6OKt$fo%G@oyXc4!7 zC8$WY&F<~+>wCS+G$}ppm~%eR1BuIGI@9r~>1}%s!!lK%Agt(Ab6pB4-iXf0%ULB& z6hzvmUUPG1Pm${&Wp_=^)U2Z?7+WXySm`RUqw3E?(9cTED}-}lFSat#C$ld%N0yV| zH>rhL?fboYErF9#SZ>lAq4u)Rzh04*y&O3(+p)vP9`qUS*KCFR?S!wXk%w%`5l_Y~ zi_)xa(Q1Cn7jsaG`XF?k9+97@b)lnhW}TaT)!V06A(U_yS7wyyi7e$mjp8x1VoYxQZ4Jf`tkel8HY`9@Jga~jd= z)>f6={gBoBRi2zg0j)B_?q^7AW#m6Hm~>j1hDI%snRAta;AI~Q`*i3@^OBctUq#6k<245*~tteZ#{dI-`)AR_@WwL7VJ9iu-#$z98Uc-s9%Z;$J9eoT?at! z)H3Zl-eMoi%~%CWGqR96blg#BjT|23)4 z9$SRjdCuZZr#6k-UF=Eu&UySp{fO$x8y}JFW^z6P1b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vQ?I z%C*;7TwsA#9*nO*WVvl)+9=4otb_hs`;jX40MJ;Ay|*kqGZG>`Ql*u=b?bi&cLG79 z3N->(OSk97yKOVTO_nAX8P0p7r<}he(X!ij>#|J>MGjroP7DdCApvh?Z88NF8}jOJ z^#YpyCfbV)e)Ysas1n#fQ>^iOEPd8BB#S$Th@%Jy4+RusIa92Lwor6Akmdd^0}g}p zJsf4`{II2QI{kNHbcNK_v5J!3DekXj4}-7Y8_+v_8DDb+OXU*#{XQWHn2QgQN4|Ik z8@x#^FW?*L`JLV~tJ)y#tz3~%c<;5cBQxMAcL;?r{YzR1 z3~z4IrZ5|zxjY`<**4Cfp-7H9#N8>B1hPw=ZM_H+XKN3@)By7Qlt3w)H-<+EvakxX zs=lW>v@YS$K#M)qocLIJ!3h`ScDqk))${oCGbd#bP_ow-I+FL-Ob(~72w{*$E6`Yh tPB(R0XZ$xt_}?w`e_E-BfX}XE^`> diff --git a/example/images/keyboard/keyboard.png b/example/images/keyboard/keyboard.png index dc3693760fc736f9649124d63431ca246b5dc7b0..70a76197893115bb80e54a84eb597df4bd76086a 100644 GIT binary patch literal 2163 zcmdT``8OMg7EWp@X>CKRV=tx{O3~1SG}c;1QFKkEi&pHR#8#rU8)~VoMZ`{}qFZ7~ zG}@u|S`)=lQz{X=1hK~R<_~!1y&vB%_xtWW_m}Ux_nvc8oE>e%Kyn}e03c>(Yvlp} z0L>2hs))d0yu`hH^ALoc9o(!B@!;T~atuFt$bca(j;;VR<~L6OKt$fo%G@oyXc4!7 zC8$WY&F<~+>wCS+G$}ppm~%eR1BuIGI@9r~>1}%s!!lK%Agt(Ab6pB4-iXf0%ULB& z6hzvmUUPG1Pm${&Wp_=^)U2Z?7+WXySm`RUqw3E?(9cTED}-}lFSat#C$ld%N0yV| zH>rhL?fboYErF9#SZ>lAq4u)Rzh04*y&O3(+p)vP9`qUS*KCFR?S!wXk%w%`5l_Y~ zi_)xa(Q1Cn7jsaG`XF?k9+97@b)lnhW}TaT)!V06A(U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1`J&^*=VDPo+D1CKYG?a9v(OSn+(Q`36B(HuNA zqV3j5Hzpmrid=0teU+Wmp<6tyTO#CgQj%^4r)#g=iZ$}t9+F|S&0jtE%k;FFLZcNi z;@~TycYw?pjbARUe=_v_gZiJ{YVm0d_W}5~))}t-@WWa?s|=-)bD-e98TVpTKd;8h z(K;h{Fc+_iap6sbr84T3iJ?9xH}fkuaTc8druDKpxz`f`DU$CLwYQL&8g2xH=6w$@iHi%466vQ?I z%C*;7TwsA#9*nO*WVvl)+9=4otb_hs`;jX40MJ;Ay|*kqGZG>`Ql*u=b?bi&cLG79 z3N->(OSk97yKOVTO_nAX8P0p7r<}he(X!ij>#|J>MGjroP7DdCApvh?Z88NF8}jOJ z^#YpyCfbV)e)Ysas1n#fQ>^iOEPd8BB#S$Th@%Jy4+RusIa92Lwor6Akmdd^0}g}p zJsf4`{II2QI{kNHbcNK_v5J!3DekXj4}-7Y8_+v_8DDb+OXU*#{XQWHn2QgQN4|Ik z8@x#^FW?*L`JLV~tJ)y#tz3~%c<;5cBQxMAcL;?r{YzR1 z3~z4IrZ5|zxjY`<**4Cfp-7H9#N8>B1hPw=ZM_H+XKN3@)By7Qlt3w)H-<+EvakxX zs=lW>v@YS$K#M)qocLIJ!3h`ScDqk))${oCGbd#bP_ow-I+FL-Ob(~72w{*$E6`Yh tPB(R0XZ$xt_}?w`e_E-BfX}XE^`> diff --git a/example/keyboard/keyboard/gen.go b/example/keyboard/keyboard/gen.go index 3fb8b4f2e..4b2b61ae4 100644 --- a/example/keyboard/keyboard/gen.go +++ b/example/keyboard/keyboard/gen.go @@ -22,6 +22,7 @@ import ( einternal "github.com/hajimehoshi/ebiten/internal" "image" "image/color" + "image/draw" "image/png" "log" "os" @@ -103,12 +104,18 @@ func outputKeyboardImage() (map[string]image.Rectangle, error) { y += height } + palette := color.Palette([]color.Color{ + color.Transparent, color.Opaque, + }) + palettedImg := image.NewPaletted(img.Bounds(), palette) + draw.Draw(palettedImg, palettedImg.Bounds(), img, image.ZP, draw.Src) + f, err := os.Create("images/keyboard/keyboard.png") if err != nil { return nil, err } defer f.Close() - if err := png.Encode(f, img); err != nil { + if err := png.Encode(f, palettedImg); err != nil { return nil, err } return keyMap, nil