Converting Images With Go2Webp

If you are only interested in a possible new tool for your terminal and don't care about the decision making around it, the code is up on codeberg.
For this blog, I was spending more time than I would like opening files in a photo editor and converting them to .webp. I wanted something that could convert a few different filetypes (but mostly PNGs) into the webp format. Ideally, it would be able to handle entire folders of files as well.
Initially, I searched an existing tool to do this and found mostly Python scripts. I really hate getting Python setup. Sometimes it's super simple but I've been burned enough that I went searching for something else. I will admit to not searching very hard, so I imagine there is some incredible tool I'm sleeping on.
I found some Go libraries that did this exact thing but none that I found had a CLI implementation. After deciding I was going down this path I picked a library and stuck with it. The one lament I have about the library I chose is that it is not a pure Go implementation. The library, nativewebp, does do this but the README of that page seemed to indicate that it was less robust than what I was looking for.
With libraries out of the way, I went to making a command line interface. With previous applications, I have relied on urfav/cli but I had never used the v3 version of this library and set out at that. Compared to v2 it feels simplified and I actually miss some of the verbosity of in the previous version, but the choices they made for scaffolding out an application make sense.
Despite the application being simple, I opted for named rather than positional arguments and flags. If you run go2webp without any arguments it will print the help page. I made this choice because the options I envisioned for converting folders vs files eventually requiring guards for different flags used in combination together. Best to avoid that all together and make that logic separate.
One consideration made was handling the possibility of converting a large amount of files. I made sure that the folder processing would happen concurrently and instead of errors causing the application to stop (as happens when processing individual files) the errors are collected and presented at the end of the processing run. It will return the number of completed files, how long it took, and the errors that happened during the run. The errors return before the successfully converted file count iterates up, so your converted file count should be accurate.
Example Output
``` 2026/06/05 21:02:37 Folder conversion completed with errors. Converted 161 files. Elapsed time: 33.14459ms
Errors: failed to convert xhdn0g08.png: conversion failed for ../../external/pngsuite/png/xhdn0g08.png: failed to decode image png: invalid format: invalid checksum failed to convert xd9n2c08.png: conversion failed for ../../external/pngsuite/png/xd9n2c08.png: failed to decode image png: unsupported feature: bit depth 99, color type 2 failed to convert xs2n0g01.png: conversion failed for ../../external/pngsuite/png/xs2n0g01.png: failed to decode image image: unknown format failed to convert xc9n2c08.png: conversion failed for ../../external/pngsuite/png/xc9n2c08.png: failed to decode image png: unsupported feature: bit depth 8, color type 9 ```
I would go on but there's not much else to say. Go2Webp is a CLI tool with named arguments and flags that allows you to convert bmp, gif, jpg, png, and tiff files into webp. If you have a plethora of them, you can do that with a bit of giddyup thanks to the go routine enabled batch processing. Thanks for reading!
If you liked this piece, consider supporting the work at Screaming at the Silicon*. The main in-progress series is* We Have the Torment Nexus at Home, where I go through setting up and using local language models with free software, but there is other computer and programming work entirely unrelated to tech de jour already available and in the pipeline.
License
This piece Converting Images With Go2Webp © 2026 by Glass Hound Computing, LLC is licensed under CC BY-NC-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/
The accompanying image Go2Webp Gopher © 2026 by Glass Hound Computing, LLC is licensed under CC BY-SA 4.0. To view a copy of this license, visit https://creativecommons.org/licenses/by-nc-sa/4.0/