クラッシュ・ハードディスク

2010/02/08 : morh
snowkrash

うっむー。ひとまず報告を。

ハードディスク、クラッシュしました。macbook, leopard。ちょうど一件仕事が完了したあとで不幸中の幸い、というのかどうか。
これまで平均年一遭難程度だったのが、今回は8ヶ月しかもたなかった。
恐ろしや。

モノの扱いはソフトな方なんですけどねー。
ソフトコア野郎。と言ってみる。

原因は分かんないけど、人柱的に、クラッシュ前の状況を書きとどめておきます。

とある実験に、HDDの120GBを占めている、割に小さいデータ群へのランダムアクセスを集中的にやっていた。iTunesでシャフルプレイするのによく似たことですよ。
CPU負荷やらファンやらに変わったところはなかった。
quicklookが効かなくなって、ctrl+tabのアプリ切り替えも効かなくなり、フォルダ表示に異様に時間がかかり始めたところで、カッツンカッツンというプラッタに引っかかる、れいのサウンドが出たところで、終了。

あ゛ーHDD交換では連動してiPhoneのデータはすべて消去です。とかヒドいことappleさんから言われるのかなあ。今からググりますよ。
ごめんねブログでデトックスしちゃって。

毎度のことながら、ノウハウたまってきてますよ!
-
10日刻みでtime machineでバックアップしてまして、
かつ、前回のクラッシュ以降、そー前回はtime machineでバックアップ中にクラッシュしたんですよ。あり得なさすぎ。
クラウドに預けられるものはそっちに置くようにしてますので、そこそこ復旧はできるかと。
-
というわけで、関係者のみなさま。
これまでの経験上、その都度、外部書き出し&管理してますのでご安心ください。
心配な点などありましたらメールください。
話が黒くならないうちに、取り急ぎご報告まで
ご自愛ください

人を自由にする知恵の道具: iPadヨタ話

2010/01/29 : morh

iPadhttp://www.apple.com/ipad/)出ましたね。

発表から2日経った現在の記録に、思ったことを書き留めてみます。

新しいイノベーションが出ると、過剰にオプティミスティックな妄想が爆発しますよね。そんな話。

“The iPad is for consuming media, not producing media — I don’t like that direction.”REAS

twitter上のTLを見ていて、おおきくナットクしながら、さっきフロ入りながら考えていたら、いやそうでもないかも、と思いはじめ、最後によた話的な妄言まで想像してたので、同意と反論と妄言をまとめます。

-

1.情報は、コンピュータで生産、iPadで消費?

パソコン使う層とケータイで十分という層の区分けのようなものが、iPadの出現で、情報生産する層と情報消費する層に分かれる。

前述のtwitter上の発言は、このような指摘と解釈しました。

これまで、おおざっぱなくくりとしてコンピュータを使っていた人々が、生産しやすい道具を求めてコンピュータを使い続けるか、消費しやすい道具を求めてiPadを買うかに分かれる。

コンピュータでゴリゴリ生産する層と、iPadで消費する層。

ネットブックよりも情報消費が楽しい道具の出現。

でもそうかいなと。

-

2.iPadならではの情報生産を支援する環境が出てくることを期待。

個人的な経験に照らし合わせるに、osXに移行した直後はsafariでネットするぐらいしか使い道がなくて、生産はos9側でやっていた。そして、時間の経過とともにosX上の生産環境が充実した。

iPhoneもよく似た経緯を辿っているように思う。twitterとかustreamとか、iPhoneならではの新しい遊び方、使い方によって、情報の生産消費者が出現した。

なのでiPadも、情報消費の道具に完結しない、iPadならではの生産のための環境がappstoreから出てくると期待したい。

それはどんな使われ方をする?

-

3.与太話

物理的に人と会って、おしゃべりしながら、アイデアの連想ゲームをする。対面しながら知恵比べする。その時、彼らの間のテーブルや、あるいは芝生の上にiPadは転がっている。新しい遊び方、使い方の為の、らくがき帳みたいない存在で、情報の生産消費を支援する。

ほとんどなにも考えないで指で触れて、ひらめきの記録と構造化と検索が切れ目なく行われる。下向きに覗き込めるというのがいい。

逆に、iPadの出現から、ノートパソコンを見返すと、ノートパソコンはずいぶん不思議な存在だったのではないかと思えてくる。ミーティングなど対面でやりとりするのに、人によっては間にノートパソコンを置いて、モニターを立てて壁を作ってしまう。彼は目の前の相手よりもノートパソコンのモニターと話してしまっている。

Wireless Keyboardが使えるというのが決め手で、買う気まんまんですよ。

あんまりゼニくさい方面の、消費のためのプラットフォームばかりじゃなく、

生活のたのしさの延長の、我々のためのメディアであってほしい

We’ve always tried to be at the intersection of technology and liberal arts — we want to make the best tech, but have them be intuitive. It’s the combination of these two things that have let us make the iPad.

iPadの電子ブックリーダーというところは、あまり興味なし。

あくまで妄言ですから、真に受けないでね。

謹賀新年

2010/01/08 : morh
nenga2010
遅ればせながら、あけましておめでとうございます。
昨年、お世話になった皆様、ありがとうございました。
(リアル住所のわかる方には遅ればせながら印刷版をお送りしました)
本年も宜しくお願いいたします。
nenga2010

0616

2009/06/16 : morh
昨夜はコックピット(カプセルホテル)に泊まった。
午後に面接を一件受け、これで東京でのスケジュールがすべて完了。
思い立って、ケータイでぽちっと座席を予約し、新宿へ。
バスに乗って3時間。現在、長野駅前のビジネスホテル。
-
明日は、過去に、すこしだけ担当した中心市街地再開発案件の竣工後の状態を見に行こうと思う。
それと、善光寺と、そこに至る参道空間をみる。
長野県信濃美術館・東山魁夷館は明日は休館日。がっくし。谷口吉生物件とは巡り合わせが悪く、よく休館日にあたる。
昨夜はコックピット(カプセルホテル)に泊まった。
午後に面接を一件受け、これで東京でのスケジュールがすべて完了。
思い立って、ケータイでぽちっと座席を予約し、新宿へ。
バスに乗って3時間。現在、長野駅前のビジネスホテル。
-
明日は、過去に、すこしだけ担当した中心市街地再開発案件の竣工後の状態を見に行こうと思う。
それと、善光寺と、そこに至る参道空間をみる。
長野県信濃美術館・東山魁夷館は明日は休館日。がっくし。谷口吉生物件とは巡り合わせが悪く、よく休館日にあたる。

今月の5枚

2009/06/15 : morh
諸手続きを終えて、ぽっかり時間が空いてしまったので、新譜を何枚か入手する
今月の5枚
にせんねんもんだい FAN
Florian Hecker Acid In The Style Of David Tudor
No-Neck Blues Band Live at Ken’s Electric Lake
前野健太 さみしいだけ
fennesz| black sea
にせんねんもんだい FAN
にせんねんもんだいの新作は一曲35分というのがいい!切れ目無くぐんぐん行く。先日のたのしい音楽でのオプトラムとのライブがすばらしすぎで、思い出す。そうだこれだ。
Florian Hecker Acid In The Style Of David Tudor
現在、デジタルテクノロジーと美学によって、世界最前線の耳の持ち主たるフローリアンヘッカーの新作。先のリフレックス盤といい、笑いのセンスもあるのか?
No-Neck Blues Band Live at Ken’s Electric Lake
ニューヨーク秘境派!アヴァン!サイケデリック!フリー!インプロ!の2枚組。
前野健太 さみしいだけ
先日のたのしい音楽ではじめてまえけんを聞いて、ボブデュランの生まれ変わりか!という出で立ちと、そのうたに、あらまあらまと身を委ねてしまう、もーたまらん、一発で大好きになってしまった。それで探した。まえけんで探したら、見つからない。まえのけんじ?まえだけんじ?まえのけんたろう?まえだけんいちろう?まえのけんた、か。

諸手続きを終えて、ぽっかり時間が空いてしまったので、新譜を何枚か入手する

今月の5枚

にせんねんもんだい FAN

Florian Hecker Acid In The Style Of David Tudor

No-Neck Blues Band Live at Ken’s Electric Lake

前野健太  さみしいだけ

fennesz  black sea

-

にせんねんもんだい FAN

にせんねんもんだいの新作は一曲35分というのがいい!切れ目無くぐんぐん行く。先日のたのしい音楽でのオプトラムとのライブがすばらしすぎで、思い出す。そうだこれだ。

Florian Hecker Acid In The Style Of David Tudor

現在、デジタルテクノロジーと美学によって、世界最前線の耳の持ち主たるフローリアンヘッカーの新作。先のリフレックス盤といい、笑いのセンスもあるのか?

No-Neck Blues Band Live at Ken’s Electric Lake

ニューヨーク秘境派!アヴァン!サイケデリック!フリー!インプロ!の2枚組。

前野健太 さみしいだけ

先日のたのしい音楽ではじめてまえけんを聞いて、ボブデュランの生まれ変わりか!という出で立ちと、そのうたに、あらまあらまと身を委ねてしまう、もーたまらん、一発で大好きになってしまった。それで探した。まえけんで探したら、見つからない。まえのけんじ?まえだけんじ?まえのけんたろう?まえだけんいちろう?まえのけんた、か。

fennesz black sea

甘美すぎであるけれども、多層な響きが、どのような状態へ向かうのかを聴き込んでみたい

Visualizing Data Hack

2009/06/03 : morh

1950年以降の日本における人口増加数(単位: 1,000人)

1950年以降の日本における人口増加数(単位: 1,000人)

visualizing dataのコードを元にスタディしてみる。

総務省統計局 平成19年10月1日現在推計人口ー全国:年齢(5歳階級),男女別人口(pdf)および帝国書院統計資料 歴史統計 男女別人口、人口増減の数値を元に、processingにてビジュアライジング。

グラフの形式を棒グラフに変更し、プロット領域に画像をマップするようにコードを書き加えた。

opticode

2009/02/07 : morh
hysyskさんのコードから多くのインスピレーションを受け、改変した。
optical barcode -> opticode
ぱっと見えるかたちと、じっくり見ることでみえてくる図像について。
じっくり見ることでみえてくる図像とは、見る人が部分の示唆するものを想像し、足りないところを補完して見ているのかもしれない。
それをモデル化するに、できるかぎり明快な2つのパターンで出来ていると考えてみる。ひとつめのパターンは、隠された図像の隠し方のパターン(この場合はストライプ)。 もう一方は現れ方のパターン(線のゆがみ)。
隠される図像と隠すパターンの交差する点の明るさの値を取り、その値と比例して交点の位置をずらす。交点を減らすほどパターンが強くなり、交点を増やすほど隠した図像がみえる。
code.1503 /morh /2009.02.06 1:26

code.1503 /morh /2009.02.06 1:26

hysyskさんのコードから多くのインスピレーションを受け、改変した。

optical barcode -> opticode

ぱっと見えるかたちと、じっくり見ることでみえてくる図像について。

じっくり見ることでみえてくる図像とは、見る人が部分の示唆するものを想像し、足りないところを補完して見ているのかもしれない。

それをモデル化するに、できるかぎり明快な2つのパターンで出来ていると考えてみる。ひとつめのパターンは、隠された図像の隠し方のパターン(この場合はストライプ)。 もう一方は現れ方のパターン(線のゆがみ)。

隠される図像と隠すパターンの交差する点の明るさの値を取り、その値と比例して交点の位置をずらす。交点を減らすほどパターンが強くなり、交点を増やすほど隠した図像がみえる。

change.2009 /morh /2009.02.05 22:56

change.2009 /morh /2009.02.05 22:56

Smells Like.1991 /morh /2009.02.06 2:37

Smells Like.1991 /morh /2009.02.06 2:37

//import processing.pdf.*;

//optical code(opticode) ver1.0

//by morh 2009.02.05

PImage a;

a = loadImage(“obama_pic.jpg”);

int xnum = 15;

int ynum = 40;

float range = 3.5; // 2.0-4.0

int diagonal = -1; //-1 / 0 / 1; only 45,30,,,

float h = 5.7; // hue; 0.0-7.0

float s = 10.0; // 0.0-10.0

float b = 5.0; // 0.0-10.0

int imgW = a.width;

int imgH = a.height;

int xdv = xnum*2;

int ydv = ynum*2;

int xpth = imgW/xdv; //wanna change float number

int ypth = imgH/ydv; //wanna change float number

int dgnlx = diagonal*imgW*ypth;

background(235);

size(imgW, imgH);

//size(imgW, imgH, PDF, “aaa.pdf”);

colorMode(HSB, range);

noStroke();

float Hscl = map(h, 0, 7.0, 0, range);

float Sscl = map(s, 0, 10.0, 0, range);

float Bscl = map(b, 0, 10.0, 0, range);

fill(Hscl,Sscl,Bscl);

a.loadPixels();

smooth();

//for(int i=-dgnlx; i<=imgW; i+=xpth) { //if diagonal > 0; not work?

for(int i=0; i<=imgW-dgnlx; i+=xpth) { //if diagonal < 0

if(i%(2*xpth)==0){

beginShape();

for(int j=0; j<=imgH; j+=ypth) {

int x = i+xpth/2+j*diagonal;

int y = j;

//            point(x, y);

//            vertex(x, y);

int loc = (abs(x%a.width)) + abs((y%a.height))*a.width;

int br = int(brightness(a.pixels[loc]));

vertex(x+br, y);

}

}

else{

for(int j=ydv*ypth*2; j>=0; j-=ypth) {

//calculate x2 length to get same height

int x = i+xpth/2+j*diagonal;

int y = j;

//            point(x, y);

//            vertex(x, y);

int loc = (abs(x%a.width)) + abs((y%a.height))*a.width;

int br = int(brightness(a.pixels[loc]));

vertex(x-br, y);

}

endShape();

}

//  exit();

}

glitch (alike) machine的な

2009/02/04 : morh

ピクチャ 3

ピクチャ 5

glitch alike machine(http://abstrakt.vade.info/?p=48)的なものを、インスタントにつくった

//glitch (alike) machine ver1.0

//morh 2009.02,04

int unt = 10; //size of block noise

int num =20; //times of glitching (4-6)

int pst = 4; //posterized step (4-6)

PImage imgsrc;

void setup(){

imgsrc = loadImage(“Untitled (Menil House, #01), 2002.jpg”);

size(imgsrc.width, imgsrc.height);

colorMode(HSB, 255);

}

void draw() {

image(imgsrc,0,0);

for(int n=0; n<num; n++){

int h = int(random(255)); //hue

int s = 255;

int b = 255;

int alp = 255;

int wd = int(random(width-unt));

int hg = int(random(height/3,(height-unt)));

PImage crop = get(wd, hg, (width-wd), unt);

crop.filter(INVERT);

crop.filter(POSTERIZE, pst);

tint(h, s, b, alp);

image(crop, wd, hg, (width-wd), unt);

noTint();

PImage cropl = get(0, hg+10, width, height-hg+10);

cropl.filter(INVERT);

cropl.filter(POSTERIZE, pst);

tint(h, s-100, b-50, alp);

cropl.blend(imgsrc, 0, hg+10, width, height-hg+10,

0, hg+10, width, height-hg+10, LIGHTEST);

//better effects are LIGHTEST >ADD >DARKEST

image(cropl, 0, hg+10, width, height-hg+10);

noTint();

}

noLoop();

}

void mousePressed() {

loop();

}

glitch alike machine的なものを、インスタントにつくった
//glitch (alike) machine ver1.0
//morh 2009.02,04
int unt = 10; //size of block noise
int num =20; //times of glitching (4-6)
int pst = 4; //posterized step (4-6)
PImage imgsrc;
void setup(){
imgsrc = loadImage(“Untitled (Menil House, #01), 2002.jpg”);
size(imgsrc.width, imgsrc.height);
colorMode(HSB, 255);
}
void draw() {
image(imgsrc,0,0);
for(int n=0; n<num; n++){
int h = int(random(255)); //hue
int s = 255;
int b = 255;
int alp = 255;
int wd = int(random(width-unt));
int hg = int(random(height/3,(height-unt)));
PImage crop = get(wd, hg, (width-wd), unt);
crop.filter(INVERT);
crop.filter(POSTERIZE, pst);
tint(h, s, b, alp);
image(crop, wd, hg, (width-wd), unt);
noTint();
PImage cropl = get(0, hg+10, width, height-hg+10);
cropl.filter(INVERT);
cropl.filter(POSTERIZE, pst);
tint(h, s-100, b-50, alp);
cropl.blend(imgsrc, 0, hg+10, width, height-hg+10,
0, hg+10, width, height-hg+10, LIGHTEST);
//better effects are LIGHTEST >ADD >DARKEST
image(cropl, 0, hg+10, width, height-hg+10);
noTint();
}
noLoop();
}
void mousePressed() {
loop();
}

Hello processing その2

2009/01/27 : morh
m2nd processing output: color plotter
タブ切りプレインテキスト状態のRGB値を、RGB cubic(RGB値を直交3軸とする色座標空間)にプロットするためのプログラムコード
-
デフォルトモード:RGBcubicがOpenGLで描画され、マウスに合わせ回転する(processing sample:3D> form>RGBcubeより)
また、以下の4つの状態がキーアサインされている。
plot mode:[q]キー、取り込んだRGB値を3軸散布図上にプロットする
plot + axis mode:[w]キー、プロットデータと、XYZ軸を表示する
plot + vector mode:[a]キー、RGB値を取り込まれた順番に結線表示する
wireframe mode:[s]キー、プロット、座標軸、結線をすべて表示する
-
proessingの書き方の練習といえども、車輪の再発明なのは明白。しかし、たとえば、任意の軸を描けるようにして、その軸に対してプロットした値を回転させるだけでも、カラーリスト間の比率を保持したカラースキーム作りに転用できるかもしれない。

plotter6-290x300my 2nd processing output: color plotter

タブ切りプレインテキスト状態のRGB値を、RGB cubic(RGB値を直交3軸とする色座標空間)にプロットするためのプログラムコード

-

デフォルトモード:RGBcubicがOpenGLで描画され、マウスに合わせ回転する(processing sample:3D> form>RGBcubeより)

また、以下の4つの状態がキーアサインされている。

plot mode:[q]キー、取り込んだRGB値を3軸散布図上にプロットする

plot + axis mode:[w]キー、プロットデータと、XYZ軸を表示する

plot + vector mode:[a]キー、RGB値を取り込まれた順番に結線表示する

wireframe mode:[s]キー、プロット、座標軸、結線をすべて表示する

-

proessingの書き方の練習といえども、車輪の再発明なのは明白。しかし、たとえば、任意の軸を描けるようにして、その軸に対してプロットした値を回転させるだけでも、カラーリスト間の比率を保持したカラースキーム作りに転用できるかもしれない。

 

/*

colorPLOTTER revision0127 by morh

*/

 

import processing.opengl.*;

String[] lines;

float xmag, ymag = 0;

float newXmag, newYmag = 0; 

//PFont fontA;

PImage lg;

 

void setup() 

  size(640, 640, OPENGL); 

  noCursor();

  colorMode(RGB, 1); 

  lines = loadStrings(“lines.txt”);

  lg = loadImage(“colorplotter.png”);

 

void draw(){ 

  noStroke(); 

  background(0.5);

  pushMatrix(); 

  translate(width/2, height/2, -30); 

  newXmag = mouseX/float(width) * TWO_PI;

  newYmag = mouseY/float(height) * TWO_PI;

  float diff = xmag-newXmag;

  if (abs(diff) >  0.01) { 

    xmag -= diff/4.0; 

  }

  diff = ymag-newYmag;

  if (abs(diff) >  0.01) { 

    ymag -= diff/4.0; 

  }

  rotateX(-ymag); 

  rotateY(-xmag); 

  scale(120);

  switch(key){

  default: 

    colorCube();

    break; 

  case ‘q’:   

    plotter(1.2, 10);      

    break; 

  case ‘w’:

    plotter(1.0, 10);      

    wireCube(1.0);      

    break; 

  case ‘a’:

    plotter(1.0, 10);      

    vectors(0.0, 0.2);            

    break; 

  case ’s’:

    plotter(1.0, 10);      

    wireCube(1.0);      

    vectors(0.0, 0.2);      

    break; 

  }

  popMatrix();  

  //   fill(1);

  //   text(“q; plot,  w; plot + axis,  a; plot + vector,  s; wireframe”

  //     ,20, height-15);

 

  image(lg, 10, height-40, lg.width, lg.height);

 

void plotter(float Scl, int surface){

  noStroke();

  for(int index=0; index < lines.length; index++){

    String[] pieces = split(lines[index], ‘\t’);

    if (pieces.length == 3) {

      float a = float (pieces[0]) ;

      float b = float (pieces[1]) ;

      float c = float (pieces[2]) ;

      pushMatrix();

      float X = map(a, 0, 255, -1, 1) ;

      float Y = map(b, 0, 255, -1, 1) ;

      float Z = map(c, 0, 255, -1, 1) ;

      translate(X,Y,Z);

      float R = map(a, 0, 255, 0, 1) ;

      float G = map(b, 0, 255, 0, 1) ;

      float B = map(c, 0, 255, 0, 1) ;

      fill(R,G,B);

 

      float p = sqrt(lines.length);

      float q = (1/pow(p, 1.7));

      sphere(q*Scl);

 

      sphereDetail(surface);

      popMatrix();          

    }      

  }

}

 

void vectors(float lineColor, float lineTrns){

  PVector [] Num = new PVector [lines.length];

  for(int index=0; index < lines.length; index++){

    String[] pieces = split(lines[index], ‘\t’);

    if (pieces.length == 3) {

      float a = float (pieces[0]) ;

      float b = float (pieces[1]) ;

      float c = float (pieces[2]) ;

      float X = map(a, 0, 255, -1, 1) ;

      float Y = map(b, 0, 255, -1, 1) ;

      float Z = map(c, 0, 255, -1, 1) ;

      Num [index] = new PVector(X, Y, Z);

    }

  }

  stroke(0,0.2);

  noFill();

  beginShape();

  for(int i=0; i< Num.length ; i++){

    vertex(Num[i].x,Num[i].y,Num[i].z);

  }

  endShape();

  noStroke();

}

 

void wireCube(float lineClr){

  noFill();

  stroke(lineClr);

  box(2);  

  noStroke();

}

 

void colorCube(){

  beginShape(QUADS);

  fill(0, 1, 1); 

  vertex(-1,  1,  1);

  fill(1, 1, 1); 

  vertex( 1,  1,  1);

  fill(1, 0, 1); 

  vertex( 1, -1,  1);

  fill(0, 0, 1); 

  vertex(-1, -1,  1);

 

  fill(1, 1, 1); 

  vertex( 1,  1,  1);

  fill(1, 1, 0); 

  vertex( 1,  1, -1);

  fill(1, 0, 0); 

  vertex( 1, -1, -1);

  fill(1, 0, 1); 

  vertex( 1, -1,  1);

 

  fill(1, 1, 0); 

  vertex( 1,  1, -1);

  fill(0, 1, 0); 

  vertex(-1,  1, -1);

  fill(0, 0, 0); 

  vertex(-1, -1, -1);

  fill(1, 0, 0); 

  vertex( 1, -1, -1);

 

  fill(0, 1, 0); 

  vertex(-1,  1, -1);

  fill(0, 1, 1); 

  vertex(-1,  1,  1);

  fill(0, 0, 1); 

  vertex(-1, -1,  1);

  fill(0, 0, 0); 

  vertex(-1, -1, -1);

 

  fill(0, 1, 0); 

  vertex(-1,  1, -1);

  fill(1, 1, 0); 

  vertex( 1,  1, -1);

  fill(1, 1, 1); 

  vertex( 1,  1,  1);

  fill(0, 1, 1); 

  vertex(-1,  1,  1);

 

  fill(0, 0, 0); 

  vertex(-1, -1, -1);

  fill(1, 0, 0); 

  vertex( 1, -1, -1);

  fill(1, 0, 1); 

  vertex( 1, -1,  1);

  fill(0, 0, 1); 

  vertex(-1, -1,  1);

  endShape();

}

Hello processing その1

2009/01/27 : morh
sampler5-280x300

参照画像を指定し起動した状態

sampler4-280x300

ピックした色が右袖にスタックされる

my first processing output: color sampler

プロセシングのお勉強用に、カラーピッカーを作りながら、書き方を学習した。そんな習作。

-

任意の画像を指定のフォルダに入れ、ファイル名を指定するとウインドウに表示される。

カーソル位置がウインドウ右上に拡大表示され、カラーピックを補助する。

ピックした色は右袖にスタックされプレビューできる。

[s]キーで、ピックしたRGB値がタブ切りプレインテキストとして書き出される。

[p]キーで、pdf書き出しされ、illustratorなどpdf編集可能なアプリケーション上でそのままカラーオブジェクトとして使用可能。

//colorSAMPLER revision0127b by morh

import processing.pdf.*;

boolean saveOneFrame = false;

PImage a;

color [] d = new color[100];

int i, j, r;

int Mtx = 100;

PShape s;

int Rx,Ry;

void setup() {

//  background(255);

noStroke();

a = loadImage(“536035974_fd6abacf00_o.jpg”);

size(a.width+Mtx, a.height);

s = loadShape(“colorsampler.svg”);

}

void draw() {

if (saveOneFrame == true) { // When the saveOneFrame boolean is true,

beginRecord(PDF, “lines.pdf”); // start recording to the PDF

}

image(a, 0,0, a.width,a.height);

//preview square

PImage crop = get(mouseX-Mtx/4, mouseY-Mtx/4,Mtx/2, Mtx/2);

image(crop, a.width, 0, Mtx, Mtx);

float H = float((height-Mtx)/(i+1));//list of previous colors

for (int j = 0; j < i; j++) {

fill(d[j]);

rectMode(CORNER);

rect(a.width, Mtx+H*j, a.width+Mtx, Mtx+H*(j+1));

}

color c = get(mouseX, mouseY); //preview of active color

fill(c);

rect(a.width, Mtx+H*i, a.width+Mtx, Mtx+H*(i+1));

stroke(255);//focus point in active color

line(a.width+(Mtx/2-5), Mtx/2, a.width+(Mtx/2+5), Mtx/2);

line(a.width+(Mtx/2), Mtx/2-5, a.width+(Mtx/2), Mtx/2+5);

noStroke();

//beheaver of logos

float dst = dist(a.width/2, a.height/2, mouseX, mouseY);

if((abs(dst)>a.width)||(abs(dst)>a.height/2)){

//  if((mouseX>a.width)||(mouseX<0)||(mouseY>a.height)||(mouseY<0)){

//  if(!(mouseX<a.width)||!(mouseY<a.height)){

smooth();//logo

int ofst = 15;

float hfofst = float(ofst/2);

int sh = 35;

//    color bkgd = color(255, 255, 255, 40);//background color for low-key image

color bkgd = color(0, 0, 0, 50);

if(a.width>445){ //logos layout horizontal

strokeCap(SQUARE);

strokeWeight(ofst);

stroke(bkgd);

noFill();

rect(hfofst, hfofst, a.width-ofst, a.height-sh);

noStroke();

strokeWeight(1);

fill(bkgd);

rect(0, a.height-(sh-ofst), a.width, a.height);

shape(s, 10, height-30);

}

else {//logos layout vertical

strokeCap(SQUARE);

strokeWeight(ofst);

stroke(bkgd);

noFill();

rect(sh, hfofst, a.width-sh-hfofst, a.height-ofst);

noStroke();

strokeWeight(1);

fill(bkgd);

rect(0, 0, sh-hfofst, a.height);

pushMatrix();

translate(sh, 10);

rotate(PI/2);

shape(s,0,0);

popMatrix();

}

noStroke();

strokeWeight(1);

}

if (saveOneFrame == true) { // If the PDF has been recording,

endRecord(); // stop recording,

saveOneFrame = false; // and set the boolean value to false

}

}

void mousePressed() {

if(i<d.length){

d[i] = get(mouseX, mouseY);

i++;

}

}

void keyPressed() {

switch (key) {

case ’s’:  // Press s key to save the value data

String[] lines = new String[d.length];

for (int i = 0; i < d.length; i++) {

lines[i] = str(red(d[i])) + “\t” + str(green(d[i])) + “\t” + str(blue(d[i]));

}

saveStrings(“lines.txt”, lines);

println(“Color Values Saved”);

break;

case ‘p’: //Press p key to print pdf

saveOneFrame = true; // trigger PDF recording within the draw()

println(“Image Printed”);

break;

case ‘r’:

if(i<d.length){

Rx =int(random(0, a.width));

Ry =int(random(0, a.height));

stroke(255);

line(Rx, 0, Rx, a.height);

line(0, Ry, a.width, Ry);

//      d[i] = get(Rx, Ry);

noStroke();

break;

}

}

}

my first processing output: color sampler
プロセシングのお勉強用に、カラーピッカーを作りながら、書き方を学習した。そんな習作。
-
任意の画像を指定のフォルダに入れ、ファイル名を指定するとウインドウに表示される。
カーソル位置がウインドウ右上に拡大表示され、カラーピックを補助する。
ピックした色は右袖にスタックされプレビューできる。
[p]キーで、pdf書き出しされ、illustratorなどpdf編集可能なアプリケーション上でそのままカラー
オブジェクトとして使用可能。
[s]キーで、ピックしたRGB値がタブ切りプレインテキストとして書き出される。
//colorSAMPLER revision0127b by morh
import processing.pdf.*;
boolean saveOneFrame = false;
PImage a;
color [] d = new color[100];
int i, j, r;
int Mtx = 100;
PShape s;
int Rx,Ry;
void setup() {
//  background(255);
noStroke();
a = loadImage(“536035974_fd6abacf00_o.jpg”);
size(a.width+Mtx, a.height);
s = loadShape(“colorsampler.svg”);
}
void draw() {
if (saveOneFrame == true) { // When the saveOneFrame boolean is true,
beginRecord(PDF, “lines.pdf”); // start recording to the PDF
}
image(a, 0,0, a.width,a.height);
//preview square
PImage crop = get(mouseX-Mtx/4, mouseY-Mtx/4,Mtx/2, Mtx/2);
image(crop, a.width, 0, Mtx, Mtx);
float H = float((height-Mtx)/(i+1));//list of previous colors
for (int j = 0; j < i; j++) {
fill(d[j]);
rectMode(CORNER);
rect(a.width, Mtx+H*j, a.width+Mtx, Mtx+H*(j+1));
}
color c = get(mouseX, mouseY); //preview of active color
fill(c);
rect(a.width, Mtx+H*i, a.width+Mtx, Mtx+H*(i+1));
stroke(255);//focus point in active color
line(a.width+(Mtx/2-5), Mtx/2, a.width+(Mtx/2+5), Mtx/2);
line(a.width+(Mtx/2), Mtx/2-5, a.width+(Mtx/2), Mtx/2+5);
noStroke();
//beheaver of logos
float dst = dist(a.width/2, a.height/2, mouseX, mouseY);
if((abs(dst)>a.width)||(abs(dst)>a.height/2)){
//  if((mouseX>a.width)||(mouseX<0)||(mouseY>a.height)||(mouseY<0)){
//  if(!(mouseX<a.width)||!(mouseY<a.height)){
smooth();//logo
int ofst = 15;
float hfofst = float(ofst/2);
int sh = 35;
//    color bkgd = color(255, 255, 255, 40);//background color for low-key image
color bkgd = color(0, 0, 0, 50);
if(a.width>445){ //logos layout horizontal
strokeCap(SQUARE);
strokeWeight(ofst);
stroke(bkgd);
noFill();
rect(hfofst, hfofst, a.width-ofst, a.height-sh);
noStroke();
strokeWeight(1);
fill(bkgd);
rect(0, a.height-(sh-ofst), a.width, a.height);
shape(s, 10, height-30);
}
else {//logos layout vertical
strokeCap(SQUARE);
strokeWeight(ofst);
stroke(bkgd);
noFill();
rect(sh, hfofst, a.width-sh-hfofst, a.height-ofst);
noStroke();
strokeWeight(1);
fill(bkgd);
rect(0, 0, sh-hfofst, a.height);
pushMatrix();
translate(sh, 10);
rotate(PI/2);
shape(s,0,0);
popMatrix();
}
noStroke();
strokeWeight(1);
}
if (saveOneFrame == true) { // If the PDF has been recording,
endRecord(); // stop recording,
saveOneFrame = false; // and set the boolean value to false
}
}
void mousePressed() {
if(i<d.length){
d[i] = get(mouseX, mouseY);
i++;
}
}
void keyPressed() {
switch (key) {
case ’s’:  // Press s key to save the value data
String[] lines = new String[d.length];
for (int i = 0; i < d.length; i++) {
lines[i] = str(red(d[i])) + “\t” + str(green(d[i])) + “\t” + str(blue(d[i]));
}
saveStrings(“lines.txt”, lines);
println(“Color Values Saved”);
break;
case ‘p’: //Press p key to print pdf
saveOneFrame = true; // trigger PDF recording within the draw()
println(“Image Printed”);
break;
case ‘r’:
if(i<d.length){
Rx =int(random(0, a.width));
Ry =int(random(0, a.height));
stroke(255);
line(Rx, 0, Rx, a.height);
line(0, Ry, a.width, Ry);
//      d[i] = get(Rx, Ry);
noStroke();
break;
}
}
}