Answers:
全部一行:
for file in *.png; do pngcrush "$file" "${file%.png}-crushed.png" && mv "${file%.png}-crushed.png" "$file"; done
应该这样做。
(尽管到目前为止,在我自己的测试中,事后我测试的png不到一半pngcrush
都变小了,所以给我留下深刻的印象。)
从1.7.22版开始,pngcrush
具有覆盖选项。
尝试
pngcrush -ow file.png
有关更多信息,请参见Changelog:
Version 1.7.22 (built with libpng-1.5.6 and zlib-1.2.5)
Added "-ow" (overwrite) option. The input file is overwritten and the
output file is just used temporarily and removed after it is copied
over the input file.. If you do not specify an output file, "pngout.png"
is used as the temporary file. Caution: the temporary file must be on
the same filesystem as the input file. Contributed by a group of students
of the University of Paris who were taking the "Understanding of Programs"
course and wished to gain familiarity with an open-source program.