Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GIF interlace option not working #2560

Closed
3 tasks done
peterdn opened this issue Sep 13, 2020 · 1 comment
Closed
3 tasks done

GIF interlace option not working #2560

peterdn opened this issue Sep 13, 2020 · 1 comment

Comments

@peterdn
Copy link
Contributor

peterdn commented Sep 13, 2020

Prerequisites

  • I have written a descriptive issue
  • I have verified that I am using the latest version of ImageMagick
  • I have searched open and closed issues to ensure it has not already been reported

Description

The -interlace CLI option does not appear to work with GIFs, either with -interlace line or -interlace gif.

Steps to Reproduce

Begin with a non-interlaced GIF:

>  identify -verbose test.gif | grep Interlace
  Interlace: None
  Interlace: None
  Interlace: None
  Interlace: None

Use mogrify to add interlacing:

> mogrify -verbose -interlace gif test.gif

The command terminates successfully, but the GIF is not interlaced:

> identify -verbose test.gif | grep Interlace
  Interlace: None
  Interlace: None
  Interlace: None
  Interlace: None

The same issue is seen with convert.

System Configuration

  • ImageMagick version: ImageMagick 7.0.10-30 Q16 x86_64 2020-09-13
  • Environment (Operating system, version and so on): WSL - Ubuntu 20.04.1 LTS
@peterdn
Copy link
Contributor Author

peterdn commented Sep 13, 2020

After having a quick look in coders/gif.c I found the following that appears to clear the output interlace option if we're adjoining (which we should be, for a multi-frame GIF), and the first frame isn't NULL (which it shouldn't be if the input GIF is valid):

  if ((write_info->adjoin != MagickFalse) &&
      (GetNextImageInList(image) != (Image *) NULL))
    write_info->interlace=NoInterlace;

(link)

Commenting this out fixes the issue, and I therefore get:

> utilities/magick identify -verbose test.gif | grep Interlace
  Interlace: None
  Interlace: None
  Interlace: None
  Interlace: None

> utilities/magick mogrify -verbose -interlace gif test.gif

> utilities/magick identify -verbose test.gif | grep Interlace
  Interlace: GIF
  Interlace: GIF
  Interlace: GIF
  Interlace: GIF

I'm happy to file PR for this however I don't understand the full implications of doing this. Is there a particular reason why interlacing would need to be disabled under the above conditions?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant