text Bash:Convertir un grupo de archivos JPG a WEBP

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了text Bash:Convertir un grupo de archivos JPG a WEBP相关的知识,希望对你有一定的参考价值。

#First install the webp converter by this
sudo apt-get install webp


#go inside the directory where all images are there
#make sure all images are in RGB color mode, otherwise you will get error for CMYK images.
#Convert all images to RGB by this command (you should install ImageMagik to do that)
for f in *.jpg; do convert -colorspace RGB "$f" "${f}"; done

#finally convert all images to Webp format
for f in *.jpg; do cwebp -q 90 "$f" -o "${f}".webp; done

#Now you have filename.jpg.webp beside  filename.jpg for all your images.
#You can set the nginx or other webservers to conditionally show webp instead of jpg if browser support 
#Read this page to setup it in nginx config : https://github.com/uhop/grunt-tight-sprite/wiki/Recipe:-serve-WebP-with-nginx-conditionally

以上是关于text Bash:Convertir un grupo de archivos JPG a WEBP的主要内容,如果未能解决你的问题,请参考以下文章

sh Enviar comandos tcp通过bash一个un socket tcp

java Convertir entre diferentes tipos de datos

sql convertir fechas SQLforformatopañolofofecha date BD

php json PHP convertir数组en json字符串

javascript listas transformar valores dropdown filtro insertaFiltro insertaFiltros convertir convers

php Convertir los campos a campos obligatorios enlapáginadefinalizar compra