mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-09 07:28:44 -07:00
feat(image): add method to retrieve the image
This commit is contained in:
parent
b87fe15224
commit
2ae1da85ff
2 changed files with 7 additions and 2 deletions
5
image.go
5
image.go
|
|
@ -124,6 +124,11 @@ func (i *Image) Size() (ImageSize, error) {
|
||||||
return Size(i.buffer)
|
return Size(i.buffer)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Get image buffer
|
||||||
|
func (i *Image) Image() []byte {
|
||||||
|
return i.buffer
|
||||||
|
}
|
||||||
|
|
||||||
// Creates a new image
|
// Creates a new image
|
||||||
func NewImage(buf []byte) *Image {
|
func NewImage(buf []byte) *Image {
|
||||||
return &Image{buf}
|
return &Image{buf}
|
||||||
|
|
|
||||||
|
|
@ -164,7 +164,7 @@ func TestFluentInterface(t *testing.T) {
|
||||||
t.Errorf("Cannot process the image: %#v", err)
|
t.Errorf("Cannot process the image: %#v", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
buf, err := image.Convert(PNG)
|
_, err = image.Convert(PNG)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Errorf("Cannot process the image: %#v", err)
|
t.Errorf("Cannot process the image: %#v", err)
|
||||||
}
|
}
|
||||||
|
|
@ -180,7 +180,7 @@ func TestFluentInterface(t *testing.T) {
|
||||||
t.Fatal("Invalid image type")
|
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 {
|
func initImage(file string) *Image {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue