Skip to content

Instantly share code, notes, and snippets.

@horitaku1124
Last active November 9, 2016 00:37
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save horitaku1124/9633f25a49e2afa23e3d to your computer and use it in GitHub Desktop.
Save horitaku1124/9633f25a49e2afa23e3d to your computer and use it in GitHub Desktop.
ImageMagickのconvertコマンドのオプション

基本

convert INPUT OUTPUT

リサイズ

convert -resize 150x150 INPUT OUTPUT

PNG

色数を指定

convert -colors 256 input.png output.png

typeオプションでカラーパレットを選ぶ

# Platteを使用
convert -type Palette input.png output.png
# グレースケール
convert -type GrayScale input.png output.png

圧縮率を指定

qualityを使用 十の位が圧縮率、一のくらいが圧縮方式

convert -quality 12  input.png output.png

圧縮方式はこちら http://web.njit.edu/all_topics/Prog_Lang_Docs/html/imagemagick/www/command-line-options.html#quality

WebP

convert -define webp:lossless=true INPUT OUTPUT.webp

画質を指定

qualityを使用

convert -quality 91 -define webp:lossless=true INPUT OUTPUT.webp

色数を指定

colorsを使用

convert -colors 170 -define webp:lossless=true INPUT OUTPUT.webp
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment