{"id":402,"date":"2016-08-03T09:24:00","date_gmt":"2016-08-03T08:24:00","guid":{"rendered":"https:\/\/mokrzycki.eu\/blog\/?p=402"},"modified":"2023-08-06T00:18:23","modified_gmt":"2023-08-05T23:18:23","slug":"script-to-convert-jpeg-to-webp-github","status":"publish","type":"post","link":"https:\/\/mokrzycki.eu\/blog\/2016\/08\/03\/script-to-convert-jpeg-to-webp-github\/","title":{"rendered":"Script to convert jpeg to webp &#8211; github"},"content":{"rendered":"<pre>#\/bin\/sh\n# Inpiration: http:\/\/engineeringblog.yelp.com\/2016\/05\/yelp-android-app-went-on-a-diet.html\n# `-lossless` not used to give support for Android 4.0+\n\n# Make sure cwebp is installed.\nif ! type \"cwebp\" &gt; \/dev\/null; then\n    echo \"Please install cwebp to continue:\"\n    echo \"brew install webp\"\n    exit 1\nfi\n\n# Convert all the images in the project that are not converted.\nfor f in $(find . -name \"*.jpg\")\n  do\n    echo \"Converting $f\"\n    oldSize=$(du -h $f)\n    cwebp -pass 10 -m 6 -mt -jpeg_like -q 60 $f -o \"${f\/%.jpg\/.webp}\" &amp;&gt;\/dev\/null\n    newSize=$(du -h ${f\/%.jpg\/.webp})\n    echo \"The image was compressed: $oldSize -&gt; $newSize\"\n    rm $f\ndone\n<\/pre>\n<p><a href=\"https:\/\/gist.github.com\/SandroMachado\/9ee516bbd36768ca3844876c50cf4618\" target=\"_blank\" rel=\"noopener\">https:\/\/gist.github.com\/SandroMachado\/9ee516bbd36768ca3844876c50cf4618<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>#\/bin\/sh # Inpiration: http:\/\/engineeringblog.yelp.com\/2016\/05\/yelp-android-app-went-on-a-diet.html # `-lossless` not used to give support for Android 4.0+ #&#8230;<\/p>\n","protected":false},"author":1,"featured_media":1121,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[502],"tags":[5,286,287],"_links":{"self":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/402"}],"collection":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/comments?post=402"}],"version-history":[{"count":5,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/402\/revisions"}],"predecessor-version":[{"id":709,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/posts\/402\/revisions\/709"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/media\/1121"}],"wp:attachment":[{"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/media?parent=402"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/categories?post=402"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mokrzycki.eu\/blog\/wp-json\/wp\/v2\/tags?post=402"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}