function support_webp() {
    var elem = document.createElement('canvas');
    if (!!(elem.getContext && elem.getContext('2d'))) {
        return elem.toDataURL('image/webp').indexOf('data:image/webp') == 0;
    } else {       
        return false;
    }
}

WebP测试-及webp jpg png之间的对比

https://10.1pxeye.com/docs/webp-test/

相关文章
https://10.1pxeye.com/php%e5%88%a4%e6%96%ad%e6%b5%8f%e8%a7%88%e5%99%a8%e6%98%af%e5%90%a6%e6%94%af%e6%8c%81webp%e6%a0%bc%e5%bc%8f%e7%9a%84%e5%9b%be%e7%89%87/