I have many webp format images in a folder but with .jpg
extension like
abc-test.jpg
It's a webp
format image. I want it to convert in .png
format with same name for that I have used this command and it worked
find . -name "*.jpg" -exec dwebp {} -o {}.png \;
It converted all webp
images to .png
but the issue is it's saving images like this:
abc-test.jpg.png
But my requirement is to save it without .jpg
extension like
abc-test.png
If you have many to convert/rename, I would recommend you use GNU Parallel and not only get them converted faster by doing them I parallel, but also take advantage of the ability to modify filenames.
The command you want is:
parallel dwebp {} -o {.}.png ::: *.jpg
where the {.}
means "the filename without the original extension".
If you want to recurse into subdirectories too, you can use:
find . -name "*.jpg" -print0 | parallel -0 dwebp {} -o {.}.png
If you want a progress meter, or an "estimated time of arrival", you can add --progress
or --eta
after the parallel
command.
If you want to see what GNU Parallel would run, without actually running anything, add --dry-run
.
I commend GNU Parallel to you in this age where CPUs are getting "fatter" (more cores) rather than faster.