I have several PNG images in a directory and I'm using optipng
to optimize and reduce image size. The problem is that it takes too long to optimize all files.
I have a quad core processor and I noticed that optipng
was using only a single core
when I optimize the directory.
This is the code I'm using:
ls -1 | while read line
do
optipng -o7 "$line"
done
Is it possible to execute optipng
for four different files in parallel while reading a directory?