mirror of
https://github.com/talgo-cloud/bimg.git
synced 2026-03-13 09:20:29 -07:00
- Adding a Background option when flattening out a transparent PNG
This commit is contained in:
parent
ebb3688b44
commit
e83c80c93c
5 changed files with 42 additions and 0 deletions
10
vips.go
10
vips.go
|
|
@ -252,6 +252,16 @@ func vipsInterpretation(image *C.VipsImage) Interpretation {
|
|||
return Interpretation(C.vips_image_guess_interpretation_bridge(image))
|
||||
}
|
||||
|
||||
func vipsFlatten(image *C.VipsImage, background Color) (*C.VipsImage, error) {
|
||||
var outImage *C.VipsImage
|
||||
backgroundC := [3]C.double{C.double(background.R), C.double(background.G), C.double(background.B)}
|
||||
err := int(C.vips_flatten_image(image, &outImage, (*C.double)(&backgroundC[0])))
|
||||
if err != 0 {
|
||||
return nil, catchVipsError()
|
||||
}
|
||||
return outImage, nil
|
||||
}
|
||||
|
||||
func vipsPreSave(image *C.VipsImage, o *vipsSaveOptions) (*C.VipsImage, error) {
|
||||
// Remove ICC profile metadata
|
||||
if o.NoProfile {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue