contents
- RMagick
- 複数のgifをanimated gifに変換
- gRuby
- netpbm
- 年賀状の住所モザイク加工 by gimp
画像処理
RMagick
require 'RMagick' rwidth = 500 rheight = 200 lwidth = 10 round = 50 margin = lwidth / 2 x1 = margin y1 = margin x3 = rwidth+margin y3 = rheight+margin before = Magick::Image.new(rwidth+lwidth+1,rheight+lwidth+1) { self.background_color = 'white' } rect = Magick::Draw.new rect.fill('transparent') rect.stroke('black') rect.roundrectangle(x1,y1,x3,y3,round,round) rect.draw(before) before.write('/tmp/rmagick.gif')
複数のgifをanimated gifに変換
hao@pentaho% ls gp*.gif [~] gp01.gif gp03.gif gp05.gif gp07.gif gp09.gif gp11.gif gp02.gif gp04.gif gp06.gif gp08.gif gp10.gif hao@pentaho% convert -loop 0 -delay 100 gp*.gif anim.gif [~] hao@pentaho% ls anim.gif [~] anim.gif
gRuby
netpbm
netpbmの各種コマンドが使用する標準形式は
- ppm (Portable PixMap) … カラー画像形式
- pgm (Portable GrayMap) … グレースケール形式
- pbm (Portable BitMap) … 白黒ビットマップ形式
の3種類。この3種を包括する総合ファイル形式がpnm(Portable aNyMap)。
モノクロのgifファイルをpbmcleanに渡して処理するには、gif→ppm→pgm→pbmと変換する。
% giftopnm noise.gif| ppmtopgm| pgmtopbm| pbmclean > clean.gif
年賀状の住所モザイク加工 by gimp
フィルタ→ぼかす→ピクセル化で高さ/幅とも3pixcelくらい。 フィルタ→歪み→モザイクは、いわゆる「モザイク」でなくタイルを並べたような 画像になる。タイル高、タイル間隔を0にすれば(ダイアログからは指定できない) 「モザイク」になりそうだが、ピクセル化の方が簡単。
Last modified: 2011-03-21 by Unknown