PhotoshopのjavascriptでピクセルのRGB値を取得する方法があった

Photoshopjavascriptには直接ピクセルのRGBを取得できるようなオブジェクトが用意されていないので無理やりやらないといけない。
以下転載。

getColorAt = function(doc, x, y) {

   function selectBounds(doc, b) {
      doc.selection.select([[ b[0], b[1] ],
                           [ b[2], b[1] ],
                           [ b[2], b[3] ],
                           [ b[0], b[3] ]]);
   }
    function findPV(h) {
      for (var i = 0; i <= 255; i++ ) {
        if (h[i]) { return i; }
      }
      return 0;
    }

   selectBounds(doc, [x, y, x+1, y+1]);
    var pColour = new SolidColor();
   
    pColour.rgb.red   = findPV(doc.channels["Red"].histogram);
    pColour.rgb.green = findPV(doc.channels["Green"].histogram);
    pColour.rgb.blue  = findPV(doc.channels["Blue"].histogram);

   doc.selection.deselect(); // or, even better, undo
};

転載元はココ。
http://www.ps-scripts.com/bb/viewtopic.php?t=411


Photoshopjavascriptは便利なんだけど地味に痒いところに手が届いてないので困る。
1ピクセル選択してチャンネルのヒストグラム調べるとかどんだけー