-
Notifications
You must be signed in to change notification settings - Fork 0
sylsau/picoptim
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
picoptim.sh v20230629
Powerful script to optimize JPEG and PNG images in a flash.
Really just a wrapper around jpegoptim and pngquant. Saves a LOT of time
for web assets optimization.
REQUIREMENTS
imagemagick, jpegoptim, pngquant
USAGE
picoptim.sh FILE [-q QUALITY] [-c NCOLORS] [-s SIZE] [-r] [-n] -o OUT_FILE
OPTIONS
-o, OUT_FILE Specifies output file name. Overwrites existing file.
-q, --quality QUALITY Defines quality of the output file. QUALITY is a number from
0 to 99. Maps to jpegoptim '-m' and pngquant '--quality'.
[default = 66]
-c, --colors NCOLORS Defines the number of colors to use for PNG output. Maps to
pngquant color argument. Overwrites the QUALITY parameter.
-s, --resize SIZE Defines size of the output image. Format: {width}x{height}.
You can specify both or just one of them.
-r, --strip Removes metadata during conversion. Maps to jpegoptim '-s' and
pngquant '--strip'.
-n Fakes it, so it only prints commands.
-v, --verbose Be verbose.
EXAMPLES
$ ./picoptim.sh IN.JPG -o OUT.JPG -r
converts 'IN.JPG' to 'OUT.JPG' with 66% quality (default) and
metadatas stripped
$ ./picoptim.sh PIC.JPG -q 80 -s 1000x -o STATIC/IMG/PIC.JPG
converts 'PIC.JPG' to 'STATIC/IMG/PIC.JPG' with 80% quality and resized
to 1000px of width
$ ./picoptim.sh WIP/PIC.PNG -s x500 -o static/IMG/OUT.JPG
converts 'WIP/PIC.PNG' to 'static/IMG/OUT.JPG' with 66%
quality and resized to 500px of height
$ ./picoptim.sh /tmp/PIC.JPG -s 350x -c 32 -o static/IMG/OUT.PNG
converts '/tmp/PIC.PNG' to 'static/IMG/OUT.PNG' sampled down to 32 colors
and resized to 350px of width
AUTHOR
Written by Sylvain Saubier (<https://sylsau.com>)
REPORTING BUGS
Mail at: <[email protected]>
About
Powerful script to optimize JPEG and PNG images in a flash. Really just a wrapper around jpegoptim and pngquant. Saves a LOT of time for web assets optimization.