Shell commando 不适用于 TinyPNG 的压缩照片

Shell commando not working for compression photo's by TinyPNG

大家好,我对 shell 了解不多。 我需要压缩一些 PNG 文件,我在 web. The bash shell normally works with the API of tinyPNG

上找到了一个 bash shell 脚本

当我 运行 shell 我得到这个错误:

bash: tinypng.sh: command not found...

我试过运行这个方法:

tinypng.sh  -d [DIRECTORY]/

我也试过这样做:

bash tinypng.sh  -d [DIRECTORY]/

当我 运行 我只是这个信息时 :

NAME tinypng - Shrink PNGs using tinypng.com service.

SYNOPSIS tinypng [-dkph] -f FILE

DESCRIPTION Shrink PNGs using tinypng.com service.

On first execution, or if /DIRECTORY/DIRECTORY/.tinypng.apikey is not present, tinypng will ask for an API key.

Obtain your API key from https://tinypng.com/developers, copy and paste it when prompted.

OPTIONS

-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

Written by Rany Albeg Wein - rany.albeg@gmail.com

tinypng --help 显示您的解决方案:

tinypng -d tiny_pngs/ -- foo.jpg bar.png baz.png

这将缩小 foo.jpg、bar.png、baz.png 并将缩小的文件下载到 tiny_pngs/ 目录。