mirror of
https://github.com/talgo-cloud/talgo-libwebp.git
synced 2026-03-08 23:18:13 -07:00
Merge pull request #8 from saturday06/feature/rgb_encode
Enable encode RGB image
This commit is contained in:
commit
b8bf24acf4
3 changed files with 161 additions and 0 deletions
|
|
@ -116,6 +116,8 @@ func EncodeRGBA(w io.Writer, img image.Image, c Config) (err error) {
|
|||
pic.writer = C.WebPWriterFunction(C.writeWebP)
|
||||
|
||||
switch p := img.(type) {
|
||||
case *RGBImage:
|
||||
C.WebPPictureImportRGB(pic, (*C.uint8_t)(&p.Pix[0]), C.int(p.Stride))
|
||||
case *image.RGBA:
|
||||
C.WebPPictureImportRGBA(pic, (*C.uint8_t)(&p.Pix[0]), C.int(p.Stride))
|
||||
case *image.NRGBA:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue