From 2ae1da85ffdbd34a6c3366c2b637893eccfb505a Mon Sep 17 00:00:00 2001 From: Tomas Aparicio Date: Wed, 8 Apr 2015 10:45:25 +0200 Subject: [PATCH] feat(image): add method to retrieve the image --- image.go | 5 +++++ image_test.go | 4 ++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/image.go b/image.go index f979586..2b00d63 100644 --- a/image.go +++ b/image.go @@ -124,6 +124,11 @@ func (i *Image) Size() (ImageSize, error) { return Size(i.buffer) } +// Get image buffer +func (i *Image) Image() []byte { + return i.buffer +} + // Creates a new image func NewImage(buf []byte) *Image { return &Image{buf} diff --git a/image_test.go b/image_test.go index 36666a9..ffbeff3 100644 --- a/image_test.go +++ b/image_test.go @@ -164,7 +164,7 @@ func TestFluentInterface(t *testing.T) { t.Errorf("Cannot process the image: %#v", err) } - buf, err := image.Convert(PNG) + _, err = image.Convert(PNG) if err != nil { t.Errorf("Cannot process the image: %#v", err) } @@ -180,7 +180,7 @@ func TestFluentInterface(t *testing.T) { t.Fatal("Invalid image type") } - Write("fixtures/test_image_fluent_out.png", buf) + Write("fixtures/test_image_fluent_out.png", image.Image()) } func initImage(file string) *Image {