// キャンバスサイズ
size(300, 300);
// 背景色
background(#ffffee);
// 塗りつぶし色
fill(#d0d0f0);
// 画像はdataディレクトリに置いておく
PImage img = loadImage("SF.JPG");
img.loadPixels();
for(int li=0;li<img.width*img.height;li++){
  if( floor(li / img.width) % 2 == 0 ){
    println(li);
    img.pixels[li] = 
      color(red(img.pixels[li])/2, 
      green(img.pixels[li])/2, 
      blue(img.pixels[li])/2);
  }
}
img.updatePixels();
// 画像の表示
image(img, 50, 50);
// ファイル保存
save("sample1260a.png");
元画像(sf.jpg)
出力画像(sample1260a.png)

動作環境
Processing3.4/Processing 1.0.7
〇関連項目
Processingをインストールした仮想マシンを構築するには、以下のページを参照してください。
・https://serverarekore.blogspot.com/search/label/Processing
・Processingに関する他の記事は、こちらを参照してください。
 
No comments:
Post a Comment