(8および16ビット)のようなさまざまなタイプの画像を開いていますが、それらは(モノクロ、RGB、パレットカラー)です。
これらの画像の生のピクセルデータがあります。8ビット画像用にこのようなビットマップを作成します。
//for monocrome images i am passing PixelFormat.Format8bppIndexed.
//for RGB images i am passing PixelFormat.Format24bppRgb
PixelFormat format = PixelFormat.Format8bppIndexed;
Bitmap bmp = new Bitmap(Img_Width, Img_Height,format);
Rectangle rect = new Rectangle(0, 0, Img_Width, Img_Height);
//locking the bitmap on memory
BitmapData bmpData = bmp.LockBits(rect, ImageLockMode.ReadWrite, format);
// copy the managed byte array to the bitmap's image data
Marshal.Copy(rawPixel, 0, bmpData.Scan0, rawPixel.Length);
bmp.UnlockBits(bmpData);
問題は、その bmp イメージを描画すると、元の色とは異なることです。その色付きの画像にlut(ルックアップテーブル)を適用する方法はありますか。
getixel と setPixel を試してみましたが、非常に遅いため、安全でないコードが必要です。Image.fromSource() メソッドも必要ありません。