北海道限定のサッポロクラシックがうまい。
北海道出身のひいき目かもしれないが、
電車での移動中やホテルでの晩酌はサッポロクラシックを選択します。
- 缶ビールが生ビールみたいなうまさ
- なんか濃い
- 苦味がしっかり
ぜひ、北海道旅行をする際には飲んでみることをおすすめします。
飲むときは、きんきんに冷やして、北海道の食材といっしょにどうぞ。
自分用開発メモ。
imagemagick, GNU make, jquery, YUI, Cassandra, MT, Javascript...
節操なく色んなことに手を出してます。
開発環境はdebian lennyだったけど、今は Mac or Ubuntu 10.04
$ montage -shadow gandom.jpg foo.jpgデフォルトだと、なぜか勝手にリサイズされてしまう。
$ montage -frame 5 -shadow gandom.jpg bar.jpgframeオプションと組み合わせると、フレームに対して影がつく
$ convert -frame 5 gandom.jpg foo.jpg画像にフレーム(枠)をつけることができる。
1886年、大倉喜八郎率いる大倉組商会が開拓使麦酒醸造所の払い下げを受けるが、1887年、大倉と渋沢栄一、浅野総一郎らが札幌麦酒株式会社を設立し、同社が製造販売を行う。開拓史が元のサッポロビールは、北海道の人に愛されていて、
Image: gandom.jpg
Format: JPEG (Joint Photographic Experts Group JFIF format)
Class: DirectClass
Geometry: 230x401+0+0
Type: TrueColor
Endianess: Undefined
Colorspace: RGB
Depth: 8-bit
Channel depth:
Red: 8-bit
Green: 8-bit
Blue: 8-bit
Channel statistics:
Red:
Min: 0 (0)
Max: 255 (1)
Mean: 177.153 (0.694719)
Standard deviation: 56.3777 (0.221089)
Green:
Min: 0 (0)
Max: 255 (1)
Mean: 171.555 (0.672765)
Standard deviation: 57.7193 (0.22635)
Blue:
Min: 0 (0)
Max: 255 (1)
Mean: 167.832 (0.658163)
Standard deviation: 58.7839 (0.230525)
Rendering intent: Undefined
Resolution: 96x96
Units: PixelsPerInch
Filesize: 15.4883kb
Interlace: None
Background color: white
Border color: rgb(223,223,223)
Matte color: grey74
Transparent color: black
Page geometry: 230x401+0+0
Dispose: Undefined
Iterations: 0
Compression: JPEG
Quality: 75
Orientation: Undefined
Jpeg:colorspace: 2
Jpeg:sampling-factor: 2x2,1x1,1x1
Signature: 51fa336b71c2ba60f6ed83a8f160cbf35ca9c18c2870d3f348f21ec3f2bd10a6
Tainted: False
Version: ImageMagick 6.3.7 03/24/09 Q16 http://www.imagemagick.org
$ time convert -resize 100x200 gandom.jpg foo.jpg上記のコマンドは等価。
$ time convert -thumbnail 100x200 gandom.jpg foo.jpg
satoshi@debian:/var/www/nginx-default$ time convert -resize 100x200 gandom.jpg foo.jpgサイズもまったく一緒になった。
real 0m0.132s
user 0m0.112s
sys 0m0.016s
satoshi@debian:/var/www/nginx-default$ identify foo.jpg
foo.jpg JPEG 100x174 100x174+0+0 DirectClass 8-bit 4.26172kb
satoshi@debian:/var/www/nginx-default$ time convert -thumbnail 100x200 gandom.jpg foo.jpg
real 0m0.130s
user 0m0.108s
sys 0m0.012s
satoshi@debian:/var/www/nginx-default$ identify foo.jpg
foo.jpg JPEG 100x174 100x174+0+0 DirectClass 8-bit 4.26172kb
-thumbnail geometry
This is similar to -resize, except it is optimized for speed and any image profile, other than a color profile, is removed to reduce the thumbnail size. To strip the color profiles as well, add -strip just before of after this option.
Create a thumbnail of the image.
$ identify foo.jpg上記のように、幅、高さ、サイズ、フォーマット、などなど。
foo.jpg JPEG 296x435 296x435+0+0 DirectClass 8-bit 15.3711kb
$ file foo.jpg
foo.jpg: JPEG image data, JFIF standard 1.01
画像を回転させたいときに指定するのが、rotateオプション。-rotate degrees{<}{>}
Apply Paeth image rotation (using shear operations) to the image.
$ identify video.jpgちなみに、上記の画像は動画も写真もとれる
video.jpg JPEG 300x300 300x300+0+0 DirectClass 8-bit 8.73633kb
$ convert -rotate 90 video.jpg v.jpg
$ identify v.jpg
v.jpg JPEG 300x300 300x300+0+0 DirectClass 8-bit 8.99023kb
画像のリサイズしたいときに指定するのがresizeオプション。-resize geometry
Resize an image.
$ identify ipod.jpgオリジナル画像(ipod.jpg)が以下
ipod.jpg JPEG 300x300 300x300+0+0 DirectClass 8-bit 6.625kb
$ convert -resize 50x100 ipod.jpg i.jpg
$ identify i.jpg
i.jpg JPEG 50x50 50x50+0+0 DirectClass 8-bit 730b
円形にぼかしをいれる。-radial-blur angle
Blur around the center of the image.
ノイズタイプには、以下のものを指定できる。-noise radius
+noise type
Add or reduce noise in an image
$ convert -list noiseそれぞれ、テイストが異なるノイズをかけることが出来る。
Gaussian
Impulse
Laplacian
Multiplicative
Poisson
Random
Uniform
$ cat Makefile用途としては、rmやbash、perlなどへのパスは、
.PHONY: all
include foo.mk
all:
ifdef FOO
echo $(FOO)
endif
satoshi@debian:~/git/sample-codes/gnu_make_include$ cat foo.mk
FOO = "i am foo.mk"
satoshi@debian:~/git/sample-codes/gnu_make_include$ make
echo "i am foo.mk"
i am foo.mk
$ cat Makefile文字列が等しいかどうかを確認したい場合は、
.PHONY: all
ECHO = /bin/echo
all:
ifdef ECHO
echo 'ifdef ECHO == true'
endif
ifdef FOO
echo 'ifdef FOO == true'
else
echo 'ifdef FOO == false'
endif
$ make
echo 'ifdef ECHO == true'
ifdef ECHO == true
echo 'ifdef FOO == false'
ifdef FOO == false
$ cat MakefileOSやCPUの種類によって、if文を使い、makeの挙動をわける、
.PHONY: all
ECHO = /bin/echo
all:
# 文字列として一致するか
ifeq ($(ECHO),/bin/echo)
echo 'ifeq ECHO == /bin/echo'
else
echo 'ifeq ECHO != /bin/echo'
endif
# 空白文字列が混入しやすいので
# 以下のように書くと堅牢
ifeq "$(ECHO)" "/bin/echo"
echo 'ifeq ECHO == /bin/echo'
endif
satoshi@debian:~/git/sample-codes/gnu_make_if$ make
echo 'ifeq ECHO == /bin/echo'
ifeq ECHO == /bin/echo
echo 'ifeq ECHO == /bin/echo'
ifeq ECHO == /bin/echo
$ convert gandom.jpg -modulate 100,30,100 foo.jpg元の画像は以下
-modulate brightness[,saturation,hue]
Vary the brightness, saturation, and hue of an image.
$ convert -size 100x100 xc:white -draw 'bezier 20,50 45,100 45,0 70,50 ' foo.pngできた画像は以下の通り。(上から、foo.png, bar.png)
$ convert -size 100x100 xc:white -draw 'bezier 20,50 40,0 50,0 70,50 ' bar.png
$ convert -size 100x100 xc:white -fill mistyrose -stroke pink -strokewidth 2 -draw 'roundRectangle 20,20 80,80 10,10' -draw 'image SrcOver 42,43, 16,16 heart.png' bar.pngできた画像は以下。
$ convert -size 100x100 xc:red -fill '#0000ff' -draw 'rectangle 30,30 70,70' foo.png-draw 'rectangle 始点座標x,始点座標y 終点座標x,終点座標y'と指定する。
$ convert -size 100x100 xc:white -fill '#0000ff' -draw 'roundRectangle 20,20 80,80 10,10' bar.png-draw 'roundRectangle 始点座標x,始点座標y 終点座標x,終点座標y 丸みx,丸みy'
$ convert foo.jpg -channel RGB -separate sep.jpg
$ ls sep-*jpg
sep-0.jpg sep-1.jpg sep-2.jpg
$ convert sep-0.jpg sep-1.jpg sep-2.jpg -channel RGB -combine sep.jpg
-blur radius
-blur radiusxsigma
Reduce image noise and reduce detail levels.
若干、アルゴリズムに違いがあるようだが、-gaussian-blur radius
-gaussian-blur radiusxsigma
Blur the image with a Gaussian operator
$ convert -gausian-blur 10 foo.jpg bar.jpgなにかの商品などのイメージ画像を一括で作るときなどに重宝しそう。
実行サンプル-comment string
This option places comments in a non-pixel portion of the image file. For a comment to be visibly written on the image itself, use the -annotate or -draw options.
Embed a comment in an image.
$ convert -comment 'this is comment' foo.jpg bar.jpg画像領域にコメントを入れたい場合は、-drawオプションで文字を入れるべし
2009年、秋。 今年も MA5 が始まります!よっしゃ。俺の番か。
「マッシュアップ」をキーワードに、ウェブにおける新しいユーザ体験を提案するクリエイターの活躍を応援してきた Mashup Awards(マッシュアップ・アワード)。
2006年の第1回から昨年の MA4 まで、多くの優秀な Mashup アプリケーションが生まれ、コンテストの受賞者はその活躍の場を飛躍的に広げています。
次は、あなたの番です!
satoshi@debian:/var/www/nginx-default$ convert -type TrueColor baz.png bar.png
satoshi@debian:/var/www/nginx-default$ ll b*png
-rw-r--r-- 1 satoshi satoshi 1338 2009-09-05 17:44 bar.png
-rw-r--r-- 1 satoshi satoshi 745 2009-09-04 21:57 baz.png
satoshi@debian:/var/www/nginx-default$ file baz.png bar.png
baz.png: PNG image, 76 x 76, 1-bit grayscale, non-interlaced
bar.png: PNG image, 76 x 76, 8-bit/color RGB, non-interlaced
satoshi@debian:/var/www/nginx-default$ convert -type TrueColorMatte baz.png bar.png
satoshi@debian:/var/www/nginx-default$ file baz.png bar.png
baz.png: PNG image, 76 x 76, 1-bit grayscale, non-interlaced
bar.png: PNG image, 76 x 76, 16-bit/color RGBA, non-interlaced
satoshi@debian:/var/www/nginx-default$ ll b*png
-rw-r--r-- 1 satoshi satoshi 1650 2009-09-05 17:45 bar.png
-rw-r--r-- 1 satoshi satoshi 745 2009-09-04 21:57 baz.png
$u->query_form(Operationとか昔ドキュメント読んだけど、全然覚えてないわ。
Service => 'AWSECommerceService',
Operation => 'ItemSearch',
ResponseGroup => 'Images',
Title => shift || 'Perl',
SearchIndex => 'Books',
);
[を] Perl による自分用 Amazon Product Advertising API proxy「PAPAXY」
[を] アマゾンAPIを使うのに2009年8月15日から認証が必要になるらしい
404 Blog Not Found:perl - URI::Amazon::APA released!
AmazonのAPIで認証が必要になったのでPerlで対応したよ - (゚∀゚)o彡 sasata299's blog
satoshi@debian:/var/www/nginx-default$ convert -type Bilevel foo.jpg bar.jpg
satoshi@debian:/var/www/nginx-default$ ll *jpg
-rw-r--r-- 1 satoshi satoshi 9939 2009-09-05 17:12 bar.jpg
-rw-r--r-- 1 satoshi satoshi 14767 2009-08-14 16:42 foo.jpg
$ convert -type Optimize foo.jpg bar.jpg
$ ls -l *jpg
-rw-r--r-- 1 satoshi satoshi 12791 2009-09-05 16:58 bar.jpg
-rw-r--r-- 1 satoshi satoshi 14767 2009-08-14 16:42 foo.jpg