- use the latest version of the following tools (build them from source)
- i spent a lot of time comparing and finally got to these final tools
find . -iregex '.*\.\(jpg\|jpeg\)$' -type f -exec mozjpeg -copy none -optimize -progressive -outfile {} -verbose {} \;find . -iregex '.*\.\(jpg\|jpeg\)$' -type f -exec jpegoptim --max=85 --all-progressive --strip-all {} \;
on selected images (that get reported by seo tools), use --size=97kb to limit the size to max 100 kb
find . -iregex '.*\.\(png\)$' -type f -exec pngquant --quality 40-100 --strip --verbose --skip-if-larger --output {} --force {} \;find . -iregex '.*\.\(svg\)$' -type f ! -exec grep -q 'viewBox=' {} \; -exec scour -i {} -o {}opt --enable-viewboxing \; -exec mv {}opt {} \;- all default options
- disabled: convertPathData, mergePaths, removeViewBox
- additionally enabled: removeDimensions
echo "module.exports = { plugins: ['removeDoctype','removeXMLProcInst','removeComments','removeMetadata','removeEditorsNSData','cleanupAttrs','mergeStyles','inlineStyles','minifyStyles','cleanupIDs','removeUselessDefs','cleanupNumericValues','convertColors','removeUnknownsAndDefaults','removeNonInheritableGroupAttrs','removeUselessStrokeAndFill',/*'removeViewBox',*/'cleanupEnableBackground','removeHiddenElems','removeEmptyText','convertShapeToPath','convertEllipseToCircle','moveElemsAttrsToGroup','moveGroupAttrsToElems','collapseGroups',/*'convertPathData',*/'convertTransform','removeEmptyAttrs','removeEmptyContainers',/*'mergePaths',*/'removeUnusedNS','sortDefsChildren','removeTitle','removeDesc','removeDimensions'] };" > "/tmp/svgo.config.js"; svgo --config /tmp/svgo.config.js -r -f .; rm -f /tmp/svgo.config.jsfind . -iregex '.*\.\(gif\)$' -type f -exec gifsicle --optimize=3 --output {} --verbose {} \;