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

Fails to convert GIFs #11

Open
AleksandrHovhannisyan opened this issue Jul 4, 2020 · 4 comments
Open

Fails to convert GIFs #11

AleksandrHovhannisyan opened this issue Jul 4, 2020 · 4 comments

Comments

@AleksandrHovhannisyan
Copy link

Steps to reproduce:

  1. Create a GIF in a directory currently being processed by the gem.
  2. Add ".gif" to the list of file formats.
  3. Specify ."gif" as the gif extension.
  4. Observe the following error:
 Conversion for image someImage.gif failed, no webp version could be created for this image

Here's my config:

webp:
  enabled: true
  
  # The quality of the webp conversion 0 to 100 (where 100 is least lossy)
  quality: 75

  # List of directories containing images to optimize, nested directories will only be checked if `nested` is true
  # By default the generator will search for a folder called `/img` under the site root and process all jpg, png and tiff image files found there.
  img_dir: ["/assets/img/"]

  # Whether to search in nested directories or not
  nested: true

  # add ".gif" to the format list to generate webp for animated gifs as well
  formats: [".jpg", ".png", ".gif"]

  # File extensions for animated gif files 
  gifs: [".gif"]

  # Set to true to always regenerate existing webp files
  regenerate: true

  # Local path to the WebP utilities to use (relative or absolute)
  # Omit or leave as nil to use the utilities shipped with the gem, override only to use your local install
  webp_path: nil

All other file formats work.

@N-Upchurch
Copy link

Did you ever figure this out? I'm having the same issue.

@AleksandrHovhannisyan
Copy link
Author

@N-Upchurch Nope, I didn't

@N-Upchurch
Copy link

So, it looks like you have to use gif2webp to convert gifs, not cwebp. At least, when I download the binaries and test, the latter works whereas the former does not.

I've submitted a pull request to fix this as best as I can. It's most definitely not the best way to do it, but I'm not a Ruby dev haha. Only tested on Ubuntu. In the meantime, if anyone needs to use the gif -> webp functionality, they can manually edit their local copy of the gem using the updated files in my fork, and adding the gif2webp binaries.

@AleksandrHovhannisyan
Copy link
Author

Yeah, I just process images manually on my site and use gif2webp for animated GIFs

But I think the latest version of this plugin should be able to handle GIFs (haven't tested)

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

No branches or pull requests

2 participants