现在,我正在尝试使用这样的gifsicle来压缩文件夹中的所有gif图像:
find . -name '*.gif' -exec gifsicle -O '{}' \;
但我得到以下输出(错误)
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/loading.gif' frame #10:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ajax-loader.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ui/Loader.gif' frame #10:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ui/LoaderPeque.gif' frame #31:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ui/preloader/ajax-loader-blue.gif' frame #4:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ui/preloader/ajax-loader-green.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/static/img/ui/preloader/spinner_squares_circle.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/loading.gif' frame #10:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ajax-loader.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ui/Loader.gif' frame #10:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ui/LoaderPeque.gif' frame #31:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ui/preloader/ajax-loader-blue.gif' frame #4:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ui/preloader/ajax-loader-green.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
gifsicle: While reading './4dlife/src/production/img/ui/preloader/spinner_squares_circle.gif' frame #8:
gifsicle: warning: trailing garbage after GIF ignored
gifsicle: <stdout>: is a terminal
我尝试过使用各种其他选项,如-O2或-O3或--optimize,但仍然没有运气。有什么建议吗?
答案 0 :(得分:2)
gifsicle
抱怨,因为它不想将已处理的gif写入终端。您必须将标准输出重定向到新文件,或者让gifsicle
与--batch
一起使用。
find . -name '*.gif' -exec gifsicle -O '{}' > optimized_'{}' \;
或
find . -name '*.gif' -exec gifsicle --batch -O '{}' \;