大家好,我对贝壳不太了解。
我需要压缩一些png文件,在web上找到了bash shell脚本。bash shell通常使用tinyPNG的api。
当我运行shell时,会出现以下错误:
bash:tinypng.sh:找不到命令…
我试着用这种方法运行它:

tinypng.sh  -d [DIRECTORY]/

我也试过这样做:
bash tinypng.sh  -d [DIRECTORY]/

当我运行它时,我只是这个信息:
姓名
tinypng-使用tinypng.com服务收缩PNG。
简介
tinypng[-dkph]-f文件
说明
使用tinypng.com服务收缩PNG。
第一次执行时,或者如果不存在/directory/directory/.tinypng.apikey,
tinypng将请求一个api密钥。
https://tinypng.com/developers获取api密钥,复制并
提示时粘贴。
选项
-f,--file FILE              Select a FILE to be shrinked.
    -d,--download DIRECTORY     Download all shrinked PNGs to DIRECTORY.
    -k,--key API_KEY            Use API_KEY, instead of the one stored in /DIRECTORY/DIRECTORY/.tinypng.apikey.         -p,--print                  When -d is being used, the URLs of the shrinked PNGs are not being printed to stdout.                                     Use this option to force printing even when using -d.
                                Otherwise, this option is set implicitly.
    -- FILES                    Ignore any options to come.
                                Everything after this option is considered a file.
    -h,--help                   Show this message and exit successfully.
         EXAMPLES
   Shrink foo.png, bar.png, baz.png and print the result URLs to stdout.
     $ tinypng -f foo.png -f bar.png -f baz.png
         or
     $ tinypng -- foo.png bar.png baz.png
     Shrink foo.png, bar.png, baz.png and download the result PNGs to tiny_pngs/ directory
    $ tinypng -d tiny_pngs/ -- foo.png bar.png baz.png

作者:rany albeg [email protected]

最佳答案

tinypng --help显示您的解决方案:
tinypng -d tiny_pngs/ -- foo.jpg bar.png baz.png
它将缩小foo.jpg、bar.png、baz.png,并将缩小后的文件下载到tiny_pngs/目录。

关于linux - Shell命令不适用于TinyPNG的压缩照片,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/46368525/

10-09 15:51