Gifs incorrectly resized when frame dimensions vary

Created on 14 February 2022, over 2 years ago
Updated 15 February 2024, 4 months ago

Problem/Motivation

Hi, I've been looking into an issue with our Drupal 9 site which has been performing some strange stretching of gif images and trying to work out what has been causing it.

e.g. a simple 200px proportional resize on the below image does this:

Resized:

I tracked it down to the source gif having different animation frame sizes, it seems Imagick by default reads the size from the last frame, which then leads to incorrect resizing.

See https://github.com/Imagick/imagick/issues/539

Steps to reproduce

  1. Create an image style that resizes or crops a gif
  2. Upload the attached original gif
  3. View generated image style

Note that it does require this exact gif or one very like it, due to the different sizes of the animation frames contained within.

Proposed resolution

Call coalesceImages() images before attempting to read getImageGeometry()

πŸ› Bug report
Status

Fixed

Version

1.0

Component

Code

Created by

πŸ‡¬πŸ‡§United Kingdom mattjones86 πŸ‡¬πŸ‡§ GMT+0

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.69.0 2024