Fix not animated gifs support

This commit is contained in:
DarthSim
2018-12-21 02:09:58 +06:00
parent 5501c3cff7
commit f679a7ddec
2 changed files with 12 additions and 1 deletions

View File

@@ -524,7 +524,7 @@ func processImage(ctx context.Context) ([]byte, error) {
}
defer C.clear_image(&img)
if imgtype == imageTypeGIF && po.Format == imageTypeGIF {
if imgtype == imageTypeGIF && po.Format == imageTypeGIF && vipsIsAnimatedGif(img) {
if err := transformGif(ctx, &img, po); err != nil {
return nil, err
}
@@ -682,6 +682,10 @@ func vipsArrayjoin(in []*C.struct__VipsImage, out **C.struct__VipsImage) error {
return nil
}
func vipsIsAnimatedGif(img *C.struct__VipsImage) bool {
return C.vips_is_animated_gif(img) > 0
}
func vipsImageHasAlpha(img *C.struct__VipsImage) bool {
return C.vips_image_hasalpha_go(img) > 0
}