It is already there ??
The command is “webp-express”.
usage: wp webp-express convert [<location>] [–reconvert] [–only-png] [–only-jpeg] [–quality=] [–near-lossless] [–alpha-quality] [–encoding] [–converter=<converter>]
or: wp webp-express flushwebp
Examples:
wp webp-express
: Prints usage
wp webp-express convert
: Converts all images that has not been converted yet
wp webp-express convert uploads
: Only converts the images in the uploads folder
wp webp-express convert themes
: Only converts theme images
wp webp-express convert --reconvert
: Converts all images even those that already has been converted
wp webp-express convert --only-png
: Only converts the PNG images
wp webp-express convert --quality=50 --near-lossless=50 --alpha-quality=50 --reconvert
: Sets quality, etc specifically (overriding your normal settings)
wp webp-express flushwebp
: Deletes all the converted images