mirror of
https://github.com/imgproxy/imgproxy.git
synced 2025-01-23 11:14:48 +02:00
Fix not animated gifs support
This commit is contained in:
parent
5501c3cff7
commit
f679a7ddec
@ -524,7 +524,7 @@ func processImage(ctx context.Context) ([]byte, error) {
|
|||||||
}
|
}
|
||||||
defer C.clear_image(&img)
|
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 {
|
if err := transformGif(ctx, &img, po); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -682,6 +682,10 @@ func vipsArrayjoin(in []*C.struct__VipsImage, out **C.struct__VipsImage) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func vipsIsAnimatedGif(img *C.struct__VipsImage) bool {
|
||||||
|
return C.vips_is_animated_gif(img) > 0
|
||||||
|
}
|
||||||
|
|
||||||
func vipsImageHasAlpha(img *C.struct__VipsImage) bool {
|
func vipsImageHasAlpha(img *C.struct__VipsImage) bool {
|
||||||
return C.vips_image_hasalpha_go(img) > 0
|
return C.vips_image_hasalpha_go(img) > 0
|
||||||
}
|
}
|
||||||
|
7
vips.h
7
vips.h
@ -148,6 +148,13 @@ vips_band_format(VipsImage *in) {
|
|||||||
return in->BandFmt;
|
return in->BandFmt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
gboolean
|
||||||
|
vips_is_animated_gif(VipsImage * in) {
|
||||||
|
return( vips_image_get_typeof(in, "page-height") != G_TYPE_INVALID &&
|
||||||
|
vips_image_get_typeof(in, "gif-delay") != G_TYPE_INVALID &&
|
||||||
|
vips_image_get_typeof(in, "gif-loop") != G_TYPE_INVALID );
|
||||||
|
}
|
||||||
|
|
||||||
gboolean
|
gboolean
|
||||||
vips_image_hasalpha_go(VipsImage * in) {
|
vips_image_hasalpha_go(VipsImage * in) {
|
||||||
#if VIPS_SUPPORT_HASALPHA
|
#if VIPS_SUPPORT_HASALPHA
|
||||||
|
Loading…
x
Reference in New Issue
Block a user