rosell-dk / webp-express

Wordpress plugin for serving autogenerated WebP images instead of jpeg/png to browsers that supports WebP
GNU General Public License v3.0
222 stars 63 forks source link

Convert using CLI #477

Closed quangbahoa closed 3 years ago

quangbahoa commented 3 years ago

Hello,

I've website that too much images, it more than 20gigs so I cannot convert using Bulk Convert from plugin. Can I convert using CLI or from Ubuntu command line?

Thanks

rosell-dk commented 3 years ago

You do not have to convert everything at once, if you enable one of the options to convert missing images on command (via .htaccess rules).

I'm working on a new Filemanager interface where it will be possible to bulk convert folders. I'm also considering to add the possibility to convert "in background".

rosell-dk commented 3 years ago

Yes, it is possible to bulk convert from the command line, using ie cwebp. Just make sure that you put the converted files at the correct location and with the correct file extension (corresponding with what you set webp-express up to)

quangbahoa commented 3 years ago

Thanks for your support.

ethanpil commented 3 years ago

FYI, just for the record, anyone looking to do this, if you have GNU Parallel, you can do this really fast!

Just ... yum/apt install parallel and then, I was able to run this command from wp-content/ to create the webp files: find ./ -type f \( -iname \*.jpg -o -iname \*.png \) | parallel -eta cwebp {} -o {}.webp

17000+ images in about 6 minutes on a cheap VPS!