Skip to content

Instantly share code, notes, and snippets.

@ImagingSolution
Last active November 8, 2019 13:09
Show Gist options
  • Save ImagingSolution/968436fde06cd5f71485192e0261bc5d to your computer and use it in GitHub Desktop.
Save ImagingSolution/968436fde06cd5f71485192e0261bc5d to your computer and use it in GitHub Desktop.
【C#】画像の輝度値の取得設定速度の比較
/// <summary>
/// GetPixel、SetPixelで輝度値の取得設定
/// </summary>
/// <param name="bmp"></param>
private void NegativeImage1(Bitmap bmp)
{
var width = bmp.Width;
var height = bmp.Height;
Color col;
int r, g, b;
for (int y = 0; y < height; y++)
{
for (int x = 0; x < width; x++)
{
// 輝度値の取得
col = bmp.GetPixel(x, y);
r = col.R;
g = col.G;
b = col.B;
// 色を反転
col = Color.FromArgb(255 - r, 255 - g, 255 - b);
// 輝度値の設定
bmp.SetPixel(x, y, col);
}
}
}
@ImagingSolution
Copy link
Author

【C#】画像の輝度値の取得設定速度の比較
https://imagingsolution.net/program/set_get_bright_speed/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment