Skip to content

add support to thumbnail for cropping animated images #2668

Open
@vansante

Description

@vansante

Questions, enhancements, tips, etc.

Please use libvips discussions for other topics.

https://github.com/libvips/libvips/discussions

Bug report

Describe the bug
Using vips_thumbnail_image on a GIF with multiple frames and crop set to VIPS_INTERESTING_CENTRE results in a single frame image, while using VIPS_INTERESTING_NONE results in an image with the right amount of frames.

To Reproduce
Steps to reproduce the behavior:

  1. Use Image failgif
  2. Load the image
  3. Use vips_thumbnail_image with width set to 40 and height set to 30 and crop set to VIPS_INTERESTING_CENTRE and VIPS_INTERESTING_NONE.
  4. Save the 2 images to a new GIF file with the new gifsave exporter
  5. Note how one of the images contains all 9 frames and the other has just 1 frame.

Expected behavior
I expect the resulting images to contain all 9 frames.

Actual behavior
The image which had crop set to VIPS_INTERESTING_CENTRE contains just 1 frame.

Screenshots
The resulting images:

  • VIPS_INTERESTING_CENTRE
    crop-failgif

  • VIPS_INTERESTING_NONE
    nocrop-failgif

Environment
(please complete the following information)

  • OS: Ubuntu 20.04
  • Vips:
paul@f11a770d909b:/multimedia$ vips --vips-version
libvips 8.12.2-Tue Jan 25 09:34:32 UTC 2022
paul@f11a770d909b:/multimedia$ vips --vips-config
enable debug: no
enable deprecated library components: yes
enable modules: no
use fftw3 for FFT: yes
accelerate loops with orc: yes
ICC profile support with lcms: yes (lcms2)
zlib: yes
text rendering with pangocairo: yes
font file support with fontconfig: yes
RAD load/save: yes
Analyze7 load/save: yes
PPM load/save: yes
GIF load:  yes
GIF save with cgif: yes
EXIF metadata support with libexif: yes
JPEG load/save with libjpeg: yes (pkg-config)
JXL load/save with libjxl: no (dynamic module: no)
JPEG2000 load/save with libopenjp2: no
PNG load with libspng: yes
PNG load/save with libpng: yes (pkg-config libpng >= 1.2.9)
quantisation to 8 bit: yes
TIFF load/save with libtiff: yes (pkg-config libtiff-4)
image pyramid save: yes
HEIC/AVIF load/save with libheif: yes (dynamic module: no)
WebP load/save with libwebp: yes
PDF load with PDFium:  no
PDF load with poppler-glib: no (dynamic module: no)
SVG load with librsvg-2.0: yes
EXR load with OpenEXR: yes
OpenSlide load: no (dynamic module: no)
Matlab load with matio: no
NIfTI load/save with niftiio: no
FITS load/save with cfitsio: no
Magick package: none (dynamic module: no)
Magick API version: none
load with libMagickCore: no
save with libMagickCore: no

Additional context

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions