Skip to content

Instantly share code, notes, and snippets.

@thelebster
Created September 11, 2020 06:23
Show Gist options
  • Save thelebster/bb7103597b2af47f36af66232a0e4131 to your computer and use it in GitHub Desktop.
Save thelebster/bb7103597b2af47f36af66232a0e4131 to your computer and use it in GitHub Desktop.
WebP Support in ImageMagick and PHP

WebP support in ImageMagick and php

This applies specifically to MAMP Pro, but should also be applicable to other local development setups.

ImageMagick does not install with WebP support enabled by default. In order to get this working, there are a few steps you have to take.

  1. Install or recompile ImageMagick with support for WebP.

    brew install imagemagick --with-webp
    
  2. Make MAMP’s version of PHP available via the command line. In MAMP Pro, select PHP (under Languages) and check the "Make this version available on the command line" checkbox for the version of php that you are using.

  3. Reinstall imagick for php (a native php extension for using the ImageMagick API). This ensures that php "sees" your newly installed version of ImageMagick.

    pecl install imagick
    

PHP in MAMP Pro should now be pointing to the newly compiled version of ImageMagick!

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