10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

@1x, @2x, @3x を一つの画像から作るスクリプト

Last updated at Posted at 2015-01-12

convertコマンドを使おう

gen_image.sh

# !/bin/bash

base=${1%.*}
ext=${1##*.}
for i in 1 2 3; do
    size="$(($2 * $i))x$(($3 * i))"
    dst="$base@${i}x.$ext"
    convert -resize $size $1 $dst
done

使い方

./gen_image.sh <souce_file_path> <width> <height>

例えば

./gen_image.sh button_image.png 100 50

と実行すると、

  • button_image@1x.png (サイズ100x50)
  • button_image@2x.png (サイズ200x100)
  • button_image@3x.png (サイズ300x150)

が生成されます。

このスニペットはMITライセンスで公開します。

10
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
10
10

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?