From c85369cee54a9c4a0498bf52ee8872abc36fba8f Mon Sep 17 00:00:00 2001 From: Katalina / stardust Date: Sun, 6 Aug 2017 17:10:01 -0500 Subject: [PATCH] added byte offset from new spec --- esi.go | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/esi.go b/esi.go index eac2a4c..e1e6aad 100644 --- a/esi.go +++ b/esi.go @@ -50,6 +50,8 @@ var ( errNotESI = errors.New("esi: not an esi") ) +var emptyBytes = 7 + func init() { image.RegisterFormat("esi", "esi1", Decode, DecodeConfig) } @@ -72,7 +74,7 @@ func Decode(r io.Reader) (o image.Image, err error) { img := image.NewRGBA(bounds) - buf.Next(8) + buf.Next(8 + 7) for y := bounds.Min.Y; y < bounds.Max.Y; y++ { for x := bounds.Min.X; x < bounds.Max.X; x++ { @@ -181,7 +183,7 @@ func Encode(w io.Writer, img image.Image) error { configByte |= 32 } - _, err = w.Write([]byte{configByte, 0}) + _, err = w.Write([]byte{configByte, 0, 0, 0, 0, 0, 0, 0, 0}) if err != nil { return err }