| | |
| | | /// <summary> |
| | | /// 创建PNG |
| | | /// </summary> |
| | | public void CreatePng(string filePath, int width, int height, int bands = 3) |
| | | public void CreatePng(byte[] buffer, string filePath, int width, int height, int bands = 3) |
| | | { |
| | | // 创建内存驱动 |
| | | OSGeo.GDAL.Driver memDriver = Gdal.GetDriverByName("MEM"); |
| | |
| | | { |
| | | Band band = ds.GetRasterBand(i); |
| | | band.SetRasterColorInterpretation((ColorInterp)i); |
| | | } |
| | | |
| | | // 填充内存图像 |
| | | byte[] buffer = new byte[width * height * bands]; |
| | | for (int i = 0; i < buffer.Length; i++) |
| | | { |
| | | buffer[i] = (byte)(i % 256); |
| | | } |
| | | |
| | | // 写入内存图像 |