DEV Community

Cover image for How to quickly batch resize, compress, and convert images with a Bash one-liner

How to quickly batch resize, compress, and convert images with a Bash one-liner

Victoria Drake on October 14, 2019

Part of my Hugo site continuous deployment workflow is the processing of 210 images, at time of writing. Here’s my one-liner: find public/ -not ...
Collapse
 
booyaa profile image
Mark Sta Ana • Edited

Having more workers allows you to process more data (in this case images) at the same time. The workers can process different chunks of the image. Number of workers will match the number of CPU cores you have on your computer. This is the same technique you would adopt when compiling code rather than wait for data to be processed sequentially.

Collapse
 
booyaa profile image
Mark Sta Ana

You should write a blog post that does the same thing using sharp!

Collapse
 
stiles69 profile image
Brett Salemink

Great one liner. Was looking for something just like this. Thanks!

Collapse
 
victoria profile image
Victoria Drake

Sweet! You're welcome Brett!

Collapse
 
victoria profile image
Victoria Drake

I think my work here is done. 😁

Collapse
 
vistad profile image
Victor

Super cool! I also was looking for this kind of automation. Thank you!

Collapse
 
eaich profile image
Eddie

I actually needed something like this. Thank you so much!

Collapse
 
victoria profile image
Victoria Drake

Glad to hear it! You're welcome!

Collapse
 
zcabjro profile image
zcabjro

Thanks for sharing this.

Collapse
 
victoria profile image
Victoria Drake

You're welcome! Hope it was useful to you!

Collapse
 
joshcheek profile image
Josh Cheek

We need more posts like this.

Collapse
 
victoria profile image
Victoria Drake

I'll do my best! :)