public void WritePixels() { Erdas74Pixel8 pixel = new Erdas74Pixel8(); ErdasImageFile image = new ErdasImageFile(outputGisImagePath, new Dimensions(10, 10), 1, System.TypeCode.Byte, null); byte[] bytes = new byte[1]; bytes[0] = 1; pixel[0].SetBytes(bytes, 0); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.WritePixel(pixel); } image.Close(); }
public void WriteTooManyPixels() { ErdasImageFile image = null; try { Erdas74Pixel8 pixel = new Erdas74Pixel8(); image = new ErdasImageFile(outputGisImagePath, new Dimensions(10, 10), 1, System.TypeCode.Byte, null); byte[] bytes = new byte[1]; bytes[0] = 1; pixel[0].SetBytes(bytes, 0); int pixCount = image.Dimensions.Rows * image.Dimensions.Columns; for (int i = 0; i < pixCount; i++) { image.WritePixel(pixel); } // one too many image.WritePixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }
public void WriteToReadable() { ErdasImageFile image = null; try { image = new ErdasImageFile(Data.MakeOutputPath("junk.gis"), RWFlag.Read); Erdas74Pixel8 pixel = new Erdas74Pixel8(); // write after opening for Read image.WritePixel(pixel); } catch (System.Exception exc) { Data.Output.WriteLine(exc.Message); throw; } finally { if (image != null) { image.Close(); } } }