Skip to content

Instantly share code, notes, and snippets.

@koki-h
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save koki-h/3b20ae3b048807674f4c to your computer and use it in GitHub Desktop.

Select an option

Save koki-h/3b20ae3b048807674f4c to your computer and use it in GitHub Desktop.
画像ファイルの最適化ワンライナーいろいろ
#jpegtranとgifsicleではワイルドカードが使えないのでrubyでファイル名を繰り返し渡してやる。
#JPEG
ruby -e 'ARGV.each{|file| `jpegtran -copy none -optimize -outfile #{file} #{file}`}' *.jpg
#GIF
ruby -e 'ARGV.each{|file| `gifsicle -O2 -o #{file} #{file}`}' *.gif
#PNG
optipng *.png
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment