Advertisement
Guest User

Untitled

a guest
Mar 20th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.52 KB | None | 0 0
  1. private Bitmap ReadRGBA(string filename)
  2. {
  3. if (string.IsNullOrEmpty(filename))
  4. throw new ArgumentException(filename);
  5. Bitmap source = new Bitmap(filename);
  6. Bitmap result = new Bitmap(source.Width, source.Height, PixelFormat.Format24bppRgb);
  7. for (int i = 0; i < source.Width; i++)
  8. {
  9. for (int j = 0; j < source.Height; j++)
  10. {
  11. var color = source.GetPixel(i, j);
  12. result.SetPixel(i, j, Color.FromArgb(color.A, color.B, color.G, color.R));
  13. }
  14. }
  15. return result;
  16. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement