public static void Run() { Console.WriteLine("Running example OptimizationStrategyInDicom"); using (DicomImage image = (DicomImage)Image.Create( new DicomOptions() { Source = new StreamSource(new MemoryStream()) }, 100, 100)) { // Draw something using vector graphics Graphics graphics = new Graphics(image); graphics.FillRectangle(new SolidBrush(Color.BlueViolet), image.Bounds); graphics.FillRectangle(new SolidBrush(Color.Aqua), 10, 20, 50, 20); graphics.FillEllipse(new SolidBrush(Color.Orange), 30, 50, 70, 30); // Save the pixels of the drawn image. They are now on the first page of the Dicom image. int[] pixels = image.LoadArgb32Pixels(image.Bounds); // Add a few pages after, making them darker for (int i = 1; i < 5; i++) { DicomPage page = image.AddPage(); page.SaveArgb32Pixels(page.Bounds, pixels); page.AdjustBrightness(i * 30); } // Add a few pages in front of the main page, making them brighter for (int i = 1; i < 5; i++) { DicomPage page = image.InsertPage(0); page.SaveArgb32Pixels(page.Bounds, pixels); page.AdjustBrightness(-i * 30); } string path = Path.GetTempFileName() + ".dcm"; // Save the created multi-page image to the output file image.Save(path); File.Delete(path); } Console.WriteLine("Finished example OptimizationStrategyInDicom"); }