Added optional buffer for image Read()
This commit is contained in:
parent
9f884aeec1
commit
84476c3206
4 changed files with 63 additions and 6 deletions
|
@ -136,7 +136,13 @@ For the `SetFrameBuffer()` method, the `buffer` parameter must have a length of
|
|||
|
||||
## Images
|
||||
|
||||
Vidio provides some convenience functions for reading and writing to images using an array of bytes. Currently, only `png` and `jpeg` formats are supported.
|
||||
Vidio provides some convenience functions for reading and writing to images using an array of bytes. Currently, only `png` and `jpeg` formats are supported. When reading images, an optional `buffer` can be passed in to avoid array reallocation.
|
||||
|
||||
```go
|
||||
Read(filename string, buffer ...[]byte) (int, int, []byte, error)
|
||||
Write(filename string, width, height int, buffer []byte) error
|
||||
```
|
||||
```
|
||||
|
||||
```go
|
||||
w, h, img, err := vidio.Read("input.png")
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue