1

Recently I learned how to save an image as bytes (RGB values in a text file), and now I'd like to know how to create a perfectly valid image from array of RGB values.

4

1 に答える 1

2

@dasblinkenlight で言及されているアプローチを使用できます。

int width = 1; // read from file
int height = 1; // read from file
var bitmap = new Bitmap(width, height, PixelFormat.Canonical);

for (int y = 0; y < height; y++)
   for (int x = 0; x < width; x++)
   {
      int red = 0; // read from array
      int green = 0; // read from array
      int blue = 0; // read from array
      bitmap.SetPixel(x, y, Color.FromArgb(0, red, green, blue));
   }
于 2012-04-15T11:58:54.900 に答える