mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 01:10:29 -07:00
Handle 16-bit PNGs
This commit is contained in:
parent
fd796251aa
commit
31a54299fb
3 changed files with 16 additions and 15 deletions
11
vips.go
11
vips.go
|
|
@ -55,6 +55,8 @@ type vipsSaveOptions struct {
|
|||
Interlace bool
|
||||
NoProfile bool
|
||||
Interpretation Interpretation
|
||||
Flatten bool
|
||||
Background Color
|
||||
}
|
||||
|
||||
type vipsWatermarkOptions struct {
|
||||
|
|
@ -341,6 +343,15 @@ func vipsPreSave(image *C.VipsImage, o *vipsSaveOptions) (*C.VipsImage, error) {
|
|||
image = outImage
|
||||
}
|
||||
|
||||
// Flatten image on a background, if necessary
|
||||
if o.Flatten {
|
||||
var err error
|
||||
if outImage, err = vipsFlattenBackground(image, o.Background); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
image = outImage
|
||||
}
|
||||
|
||||
return image, nil
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue