public static void Run()
        {
            // ExStart:DrawingLines
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SolidLines_out.bmp";

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir, FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;
                saveOptions.Source = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and Clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw two dotted diagonal lines by specifying the Pen object having blue color and co-ordinate Points
                    graphic.DrawLine(new Pen(Color.Blue), 9, 9, 90, 90);
                    graphic.DrawLine(new Pen(Color.Blue), 9, 90, 90, 9);

                    // Draw a four continuous line by specifying the Pen object having Solid Brush with red color and two point structures
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Red)), new Point(9, 9), new Point(9, 90));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Aqua)), new Point(9, 90), new Point(90, 90));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Black)), new Point(90, 90), new Point(90, 9));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.White)), new Point(90, 9), new Point(9, 9));
                    image.Save();
                }
            }
            // ExEnd:DrawingLines
        }
        public static void Run()
        {
            // ExStart:DrawImagesUsingCoreFunctionality
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Create an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();
            ImageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            ImageOptions.Source = new FileCreateSource(dataDir + "DrawImagesUsingCoreFunctionality_out.bmp", false);

            // Create an instance of RasterImage and Get the pixels of the image by specifying the area as image boundary
            using (RasterImage rasterImage = (RasterImage)Image.Create(ImageOptions, 500, 500))
            {
                Color[] pixels = rasterImage.LoadPixels(rasterImage.Bounds);
                for (int index = 0; index < pixels.Length; index++)
                {
                    // Set the indexed pixel color to yellow
                    pixels[index] = Color.Yellow;
                }

                // Apply the pixel changes to the image and Save all changes.
                rasterImage.SavePixels(rasterImage.Bounds, pixels);
                rasterImage.Save();
            }
            // ExStart:DrawImagesUsingCoreFunctionality
        }
Пример #3
0
        public static void Run()
        {
            Console.WriteLine("Running example DrawingRectangle");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SampleRectangle_out.bmp";

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir, FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions and Create an instance of Image
                saveOptions.Source = new StreamSource(stream);
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class,  Clear Graphics surface, Draw a rectangle shapes and  save all changes.
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);
                    graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));
                    graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));
                    image.Save();
                }
            }

            Console.WriteLine("Finished example DrawingRectangle");
        }
        public static void Run()
        {
            // ExStart:DrawingRectangle
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SampleRectangle_out.bmp";

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir, FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions and Create an instance of Image
                saveOptions.Source = new StreamSource(stream);
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class,  Clear Graphics surface, Draw a rectangle shapes and  save all changes.
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);
                    graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));
                    graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));
                    image.Save();
                }
            }
            // ExEnd:DrawingRectangle
        }
        public static void Run()
        {
            Console.WriteLine("Running example DrawingEllipse");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingEllipse_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;
                saveOptions.Source       = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and Clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw a dotted ellipse shape by specifying the Pen object having red color and a surrounding Rectangle
                    graphic.DrawEllipse(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

                    // Draw a continuous ellipse shape by specifying the Pen object having solid brush with blue color and a surrounding Rectangle
                    graphic.DrawEllipse(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));
                    image.Save();
                }
                stream.Close();
            }

            Console.WriteLine("Finished example DrawingEllipse");
        }
        public static void Run()
        {
            // ExStart:ConvertRangeOfDjVuPagesToSeparateImages
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DjVu();

            // Load a DjVu image
            using (DjvuImage image = (DjvuImage)Image.Load(dataDir + "Sample.djvu"))
            {
                // Create an instance of BmpOptions and Set BitsPerPixel for resultant images
                BmpOptions exportOptions = new BmpOptions();
                exportOptions.BitsPerPixel = 32;

                // Create an instance of IntRange and initialize it with range of pages to be exported
                IntRange range = new IntRange(0, 2);
                int counter = 0;
                foreach (var i in range.Range)
                {
                    // Save each page in separate file, as BMP do not support layering
                    exportOptions.MultiPageOptions = new DjvuMultiPageOptions(range.GetArrayOneItemFromIndex(counter));
                    image.Save(dataDir + string.Format("{0}_out.bmp", counter++), exportOptions);
                }
            }
            // ExEnd:ConvertRangeOfDjVuPagesToSeparateImages
        }
        public static void Run()
        {
            Console.WriteLine("Running example DrawImagesUsingCoreFunctionality");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Create an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();

            ImageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            ImageOptions.Source = new FileCreateSource(dataDir + "DrawImagesUsingCoreFunctionality_out.bmp", false);

            // Create an instance of RasterImage and Get the pixels of the image by specifying the area as image boundary
            using (RasterImage rasterImage = (RasterImage)Image.Create(ImageOptions, 500, 500))
            {
                Color[] pixels = rasterImage.LoadPixels(rasterImage.Bounds);
                for (int index = 0; index < pixels.Length; index++)
                {
                    // Set the indexed pixel color to yellow
                    pixels[index] = Color.Yellow;
                }

                // Apply the pixel changes to the image and Save all changes.
                rasterImage.SavePixels(rasterImage.Bounds, pixels);
                rasterImage.Save();
            }

            Console.WriteLine("Finished example DrawImagesUsingCoreFunctionality");
        }
        public static void Run()
        {
            // ExStart:DrawingBezier
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingArc_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions and create an instance of Image
                saveOptions.Source = new StreamSource(stream);
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw an arc shape by specifying the Pen object having red black color and coordinates, height, width, start & end angles
                    int width      = 100;
                    int height     = 200;
                    int startAngle = 45;
                    int sweepAngle = 270;

                    // Draw arc to screen and save all changes.
                    graphic.DrawArc(new Pen(Color.Black), 0, 0, width, height, startAngle, sweepAngle);
                    image.Save();
                }
                stream.Close();
            }
        }
Пример #9
0
        public static void Run()
        {
            //ExStart:ExportToBMP
            // The path to the documents directory.
            string MyDir = RunExamples.GetDataDir_ConvertingCAD();


            string inputFile = MyDir + "18-12-11 9644 - site.dwf";

            using (Image image = Image.Load(inputFile))
            {
                BmpOptions bmpOptions = new BmpOptions();
                var        dwfRasterizationOptions = new CadRasterizationOptions();
                bmpOptions.VectorRasterizationOptions = dwfRasterizationOptions;
                //dwfRasterizationOptions.CenterDrawing = true;
                dwfRasterizationOptions.PageHeight = 500;
                dwfRasterizationOptions.PageWidth  = 500;

                // export
                string outPath = MyDir + "18-12-11 9644 - site.bmp";
                image.Save(outPath, bmpOptions);
            }


            //ExEnd:ExportToBMP
            Console.WriteLine("\n3D images exported successfully to BMP.\nFile saved at " + MyDir);
        }
Пример #10
0
        public static void Run()
        {
            Console.WriteLine("Running example CreatingImageUsingStream");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();

            ImageOptions.BitsPerPixel = 24;

            // Create an instance of System.IO.Stream
            Stream stream = new FileStream(dataDir + "sample_out.bmp", FileMode.Create);

            // Define the source property for the instance of BmpOptions Second boolean parameter determines if the Stream is disposed once get out of scope
            ImageOptions.Source = new StreamSource(stream, true);

            // Creates an instance of Image and call Create method by passing the BmpOptions object
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                // Do some image processing
                image.Save(dataDir + "CreatingImageUsingStream_out.bmp");
            }

            Console.WriteLine("Finished example CreatingImageUsingStream");
        }
        public static void Run()
        {
            // ExStart:DrawingUsingGraphics
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SampleImage_out.bmp";

            // Create an instance of BmpOptions and set its various properties
            BmpOptions imageOptions = new BmpOptions();
            imageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property 
            imageOptions.Source = new FileCreateSource(dataDir, false);
            using (var image =  Image.Create(imageOptions, 500, 500))
            {
                var graphics = new Graphics(image);

                // Clear the image surface with white color and Create and initialize a Pen object with blue color
                graphics.Clear(Color.White);                
                var pen = new Pen(Color.Blue);

                // Draw Ellipse by defining the bounding rectangle of width 150 and height 100 also Draw a polygon using the LinearGradientBrush
                graphics.DrawEllipse(pen, new Rectangle(10, 10, 150, 100));
                using (var linearGradientBrush = new LinearGradientBrush(image.Bounds, Color.Red, Color.White, 45f))
                {
                    graphics.FillPolygon(linearGradientBrush, new[] { new Point(200, 200), new Point(400, 200), new Point(250, 350) });
                }
                image.Save();
            }
            // ExEnd:DrawingUsingGraphics
        }
Пример #12
0
        public static void Run()
        {
            //ExStart:ExportToBMP
            // The path to the documents directory.
            string MyDir = RunExamples.GetDataDir_ConvertingCAD();


            string fileName = GetFileFromDesktop("APFH Floor Plan.dwf");

            using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(fileName))
            {
                BmpOptions bmpOptions = new BmpOptions();
                var        dwfRasterizationOptions = new DwfRasterizationOptions();
                bmpOptions.VectorRasterizationOptions = dwfRasterizationOptions;
                dwfRasterizationOptions.CenterDrawing = true;
                dwfRasterizationOptions.PageHeight    = 500;
                dwfRasterizationOptions.PageWidth     = 500;
                dwfRasterizationOptions.Layouts       = new string[] { "Model" };
                // export
                string outPath = fileName + ".bmp";
                image.Save(outPath, bmpOptions);
            }


            //ExEnd:ExportToBMP
            Console.WriteLine("\n3D images exported successfully to PDF.\nFile saved at " + MyDir);
        }
Пример #13
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:DrawingLines
            // Create an instance of BmpOptions and set its various properties
            string     outpath     = dataDir + "Lines.bmp";
            BmpOptions saveOptions = new BmpOptions();

            saveOptions.BitsPerPixel = 32;

            // Create an instance of Image
            using (Image image = new PsdImage(100, 100))
            {
                // Create and initialize an instance of Graphics class and Clear Graphics surface
                Graphics graphic = new Graphics(image);
                graphic.Clear(Color.Yellow);

                // Draw two dotted diagonal lines by specifying the Pen object having blue color and co-ordinate Points
                graphic.DrawLine(new Pen(Color.Blue), 9, 9, 90, 90);
                graphic.DrawLine(new Pen(Color.Blue), 9, 90, 90, 9);

                // Draw a four continuous line by specifying the Pen object having Solid Brush with red color and two point structures
                graphic.DrawLine(new Pen(new SolidBrush(Color.Red)), new Point(9, 9), new Point(9, 90));
                graphic.DrawLine(new Pen(new SolidBrush(Color.Aqua)), new Point(9, 90), new Point(90, 90));
                graphic.DrawLine(new Pen(new SolidBrush(Color.Black)), new Point(90, 90), new Point(90, 9));
                graphic.DrawLine(new Pen(new SolidBrush(Color.White)), new Point(90, 9), new Point(9, 9));
                image.Save(outpath, saveOptions);
            }

            //ExEnd:DrawingLines
        }
Пример #14
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:DrawingArc
            // Create an instance of BmpOptions and set its various properties
            string outpath = dataDir + "Arc.bmp";
            // Create an instance of BmpOptions and set its various properties
            BmpOptions saveOptions = new BmpOptions();

            saveOptions.BitsPerPixel = 32;

            // Create an instance of Image
            using (Image image = new PsdImage(100, 100))
            {
                // Create and initialize an instance of Graphics class and clear Graphics surface
                Graphics graphic = new Graphics(image);
                graphic.Clear(Color.Yellow);

                // Draw an arc shape by specifying the Pen object having red black color and coordinates, height, width, start & end angles
                int width      = 100;
                int height     = 200;
                int startAngle = 45;
                int sweepAngle = 270;

                // Draw arc to screen and save all changes.
                graphic.DrawArc(new Pen(Color.Black), 0, 0, width, height, startAngle, sweepAngle);

                // export image to bmp file format.
                image.Save(outpath, saveOptions);
            }

            //ExEnd:DrawingArc
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:DrawingRectangle
            // Create an instance of BmpOptions and set its various properties
            string outpath = dataDir + "Rectangle.bmp";
            // Create an instance of BmpOptions and set its various properties
            BmpOptions saveOptions = new BmpOptions();

            saveOptions.BitsPerPixel = 32;

            // Create an instance of Image
            using (Image image = new PsdImage(100, 100))
            {
                // Create and initialize an instance of Graphics class,  Clear Graphics surface, Draw a rectangle shapes and  save all changes.
                Graphics graphic = new Graphics(image);
                graphic.Clear(Color.Yellow);
                graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));
                graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));

                // export image to bmp file format.
                image.Save(outpath, saveOptions);
            }

            //ExEnd:DrawingRectangle
        }
Пример #16
0
        public static void Run()
        {
            // ExStart:DrawingLines
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SolidLines_out.bmp";

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir, FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;
                saveOptions.Source       = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and Clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw two dotted diagonal lines by specifying the Pen object having blue color and co-ordinate Points
                    graphic.DrawLine(new Pen(Color.Blue), 9, 9, 90, 90);
                    graphic.DrawLine(new Pen(Color.Blue), 9, 90, 90, 9);

                    // Draw a four continuous line by specifying the Pen object having Solid Brush with red color and two point structures
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Red)), new Point(9, 9), new Point(9, 90));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Aqua)), new Point(9, 90), new Point(90, 90));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.Black)), new Point(90, 90), new Point(90, 9));
                    graphic.DrawLine(new Pen(new SolidBrush(Color.White)), new Point(90, 9), new Point(9, 9));
                    image.Save();
                }
            }
            // ExEnd:DrawingLines
        }
        public static void Run()
        {
            // ExStart:DrawingBezier
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingArc_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions and create an instance of Image
                saveOptions.Source = new StreamSource(stream);               
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw an arc shape by specifying the Pen object having red black color and coordinates, height, width, start & end angles                 
                    int width = 100;
                    int height = 200;
                    int startAngle = 45;
                    int sweepAngle = 270;

                    // Draw arc to screen and save all changes.
                    graphic.DrawArc(new Pen(Color.Black), 0, 0, width, height, startAngle, sweepAngle);
                    image.Save();
                }
                stream.Close();
            }
        }
        public static void Run()
        {
            // ExStart:DrawingUsingGraphics
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SampleImage_out.bmp";

            // Create an instance of BmpOptions and set its various properties
            BmpOptions imageOptions = new BmpOptions();

            imageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            imageOptions.Source = new FileCreateSource(dataDir, false);

            // Create an instance of Image
            using (var image = Image.Create(imageOptions, 500, 500))
            {
                // Create and initialize an instance of Graphics
                var graphics = new Graphics(image);
                // Clear the image surface with white color
                graphics.Clear(Color.White);
                // Create and initialize a Pen object with blue color
                var pen = new Pen(Color.Blue);

                // Draw Ellipse by defining the bounding rectangle of width 150 and height 100
                graphics.DrawEllipse(pen, new Rectangle(10, 10, 150, 100));
                // Draw a polygon using the LinearGradientBrush
                using (var linearGradientBrush = new LinearGradientBrush(image.Bounds, Color.Red, Color.White, 45f))
                {
                    graphics.FillPolygon(linearGradientBrush, new[] { new Point(200, 200), new Point(400, 200), new Point(250, 350) });
                }
                image.Save();
            }
            // ExEnd:DrawingUsingGraphics
        }
Пример #19
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:DrawingEllipse
            // Create an instance of BmpOptions and set its various properties
            string outpath = dataDir + "Ellipse.bmp";
            // Create an instance of BmpOptions and set its various properties
            BmpOptions saveOptions = new BmpOptions();

            saveOptions.BitsPerPixel = 32;

            // Create an instance of Image
            using (Image image = new PsdImage(100, 100))
            {
                // Create and initialize an instance of Graphics class and Clear Graphics surface
                Graphics graphic = new Graphics(image);
                graphic.Clear(Color.Yellow);

                // Draw a dotted ellipse shape by specifying the Pen object having red color and a surrounding Rectangle
                graphic.DrawEllipse(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

                // Draw a continuous ellipse shape by specifying the Pen object having solid brush with blue color and a surrounding Rectangle
                graphic.DrawEllipse(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));

                // export image to bmp file format.
                image.Save(outpath, saveOptions);
            }

            //ExEnd:DrawingEllipse
        }
        public static void Run()
        {
            Console.WriteLine("Running example ConvertRangeOfDjVuPagesToSeparateImages");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DjVu();

            // Load a DjVu image
            using (DjvuImage image = (DjvuImage)Image.Load(dataDir + "Sample.djvu"))
            {
                // Create an instance of BmpOptions and Set BitsPerPixel for resultant images
                BmpOptions exportOptions = new BmpOptions();
                exportOptions.BitsPerPixel = 32;

                // Create an instance of IntRange and initialize it with range of pages to be exported
                IntRange range   = new IntRange(0, 2);
                int      counter = 0;
                foreach (var i in range.Range)
                {
                    // Save each page in separate file, as BMP do not support layering
                    exportOptions.MultiPageOptions = new DjvuMultiPageOptions(range.GetArrayOneItemFromIndex(counter));
                    image.Save(dataDir + string.Format("{0}_out.bmp", counter++), exportOptions);
                }
            }

            Console.WriteLine("Finished example ConvertRangeOfDjVuPagesToSeparateImages");
        }
        public static void Run()
        {
            // ExStart:DrawingEllipse
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingEllipse_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;
                saveOptions.Source = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and Clear Graphics surface                    
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Draw a dotted ellipse shape by specifying the Pen object having red color and a surrounding Rectangle
                    graphic.DrawEllipse(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

                    // Draw a continuous ellipse shape by specifying the Pen object having solid brush with blue color and a surrounding Rectangle
                    graphic.DrawEllipse(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));
                    image.Save();
                }
                stream.Close();
            }
            // ExEnd:DrawingEllipse
        }
Пример #22
0
        public static void Run()
        {
            // ExStart:DrawingBezier
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingBezier_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions
                saveOptions.Source = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class
                    Graphics graphic = new Graphics(image);

                    // Clear Graphics surface
                    graphic.Clear(Color.Yellow);

                    // Initializes the instance of PEN class with black color and width
                    Pen BlackPen = new Pen(Color.Black, 3);

                    float startX    = 10;
                    float startY    = 25;
                    float controlX1 = 20;
                    float controlY1 = 5;
                    float controlX2 = 55;
                    float controlY2 = 10;
                    float endX      = 90;
                    float endY      = 25;

                    // Draw a Bezier shape by specifying the Pen object having black color and co-ordinate Points
                    graphic.DrawBezier(BlackPen, startX, startY, controlX1, controlY1, controlX2, controlY2, endX, endY);

                    // save all changes.
                    image.Save();
                }
            }
            // ExEnd:DrawingBezier
        }
Пример #23
0
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:PSDToRasterImageFormats

            String srcPath  = dataDir + @"sample.psd";
            string destName = dataDir + @"export";

            // Load an existing PSD image as Image
            using (Image image = Image.Load(srcPath))
            {
                // Create an instance of PngOptions class
                PngOptions pngOptions = new PngOptions();

                // Create an instance of BmpOptions class
                BmpOptions bmpOptions = new BmpOptions();

                // Create an instance of TiffOptions class
                TiffOptions tiffOptions = new TiffOptions(FileFormats.Tiff.Enums.TiffExpectedFormat.Default);

                // Create an instance of GifOptions class
                GifOptions gifOptions = new GifOptions();

                // Create an instance of JpegOptions class
                JpegOptions jpegOptions = new JpegOptions();

                // Create an instance of Jpeg2000Options class
                Jpeg2000Options jpeg2000Options = new Jpeg2000Options();

                // Call the save method, provide output path and export options to convert PSD file to various raster file formats.
                image.Save(destName + ".png", pngOptions);
                image.Save(destName + ".bmp", bmpOptions);
                image.Save(destName + ".tiff", tiffOptions);
                image.Save(destName + ".gif", gifOptions);
                image.Save(destName + ".jpeg", jpegOptions);
                image.Save(destName + ".jp2", jpeg2000Options);
            }

            //ExEnd:PSDToRasterImageFormats
        }
        public static void Run()
        {
            // ExStart:CreatingAnImageBySettingPath
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();
            
            // Creates an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();
            ImageOptions.BitsPerPixel = 24;

            // Define the source property for the instance of BmpOptions  Second boolean parameter determines if the file is temporal or not
            ImageOptions.Source = new FileCreateSource(dataDir + "CreatingAnImageBySettingPath_out.bmp", false);

            // Creates an instance of Image and call Create method by passing the BmpOptions object
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                image.Save(dataDir + "CreatingAnImageBySettingPath1_out.bmp");
            }
            // ExEnd:CreatingAnImageBySettingPath
        }
Пример #25
0
        public static void Run()
        {
            Console.WriteLine("Running example DrawingUsingGraphicsPath");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Create an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();

            ImageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            ImageOptions.Source = new FileCreateSource(dataDir + "sample_1.bmp", false);

            // Create an instance of Image and initialize an instance of Graphics
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                Graphics graphics = new Graphics(image);
                graphics.Clear(Color.White);

                // Create an instance of GraphicsPath and Instance of Figure, add EllipseShape, RectangleShape and TextShape to the figure
                GraphicsPath graphicspath = new GraphicsPath();
                Figure       figure       = new Figure();
                figure.AddShape(new EllipseShape(new RectangleF(0, 0, 499, 499)));
                figure.AddShape(new RectangleShape(new RectangleF(0, 0, 499, 499)));
                figure.AddShape(new TextShape("Aspose.Imaging", new RectangleF(170, 225, 170, 100), new Font("Arial", 20), StringFormat.GenericTypographic));
                graphicspath.AddFigures(new[] { figure });
                graphics.DrawPath(new Pen(Color.Blue), graphicspath);

                // Create an instance of HatchBrush and set its properties also Fill path by supplying the brush and GraphicsPath objects
                HatchBrush hatchbrush = new HatchBrush();
                hatchbrush.BackgroundColor = Color.Brown;
                hatchbrush.ForegroundColor = Color.Blue;
                hatchbrush.HatchStyle      = HatchStyle.Vertical;
                graphics.FillPath(hatchbrush, graphicspath);
                image.Save();
                Console.WriteLine("Processing completed successfully.");
            }

            Console.WriteLine("Finished example DrawingUsingGraphicsPath");
        }
        public static void Run()
        {
            //ExStart:CreatingAnImageBySettingPath
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();

            ImageOptions.BitsPerPixel = 24;

            // Define the source property for the instance of BmpOptions  Second boolean parameter determines if the file is temporal or not
            ImageOptions.Source = new FileCreateSource(dataDir + "CreatingAnImageBySettingPath_out.bmp", false);

            // Creates an instance of Image and call Create method by passing the BmpOptions object
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                image.Save(dataDir + "CreatingAnImageBySettingPath1_out.bmp");
            }
            //ExEnd:CreatingAnImageBySettingPath
        }
        public static void Run()
        {
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_PSD();

            //ExStart:DrawingBezier
            // Create an instance of BmpOptions and set its various properties
            string outpath = dataDir + "Bezier.bmp";
            // Create an instance of BmpOptions and set its various properties
            BmpOptions saveOptions = new BmpOptions();

            saveOptions.BitsPerPixel = 32;

            // Create an instance of Image
            using (Image image = new PsdImage(100, 100))
            {
                // Create and initialize an instance of Graphics class and clear Graphics surface
                Graphics graphic = new Graphics(image);
                graphic.Clear(Color.Yellow);

                // Initializes the instance of PEN class with black color and width
                Pen   BlackPen  = new Pen(Color.Black, 3);
                float startX    = 10;
                float startY    = 25;
                float controlX1 = 20;
                float controlY1 = 5;
                float controlX2 = 55;
                float controlY2 = 10;
                float endX      = 90;
                float endY      = 25;

                // Draw a Bezier shape by specifying the Pen object having black color and co-ordinate Points and save all changes.
                graphic.DrawBezier(BlackPen, startX, startY, controlX1, controlY1, controlX2, controlY2, endX, endY);

                // export image to bmp file format.
                image.Save(outpath, saveOptions);
            }

            //ExEnd:DrawingBezier
        }
        ///<Summary>
        /// ConvertCadToImages method to convert cad to images
        ///</Summary>
        public Response ConvertCadToImages(string fileName, string folderName, string outputType)
        {
            if (outputType.Equals("bmp") || outputType.Equals("jpg") || outputType.Equals("png") || outputType.Equals("gif") || outputType.Equals("svg"))
            {
                ImageOptionsBase imageOptionsBase = new BmpOptions();

                if (outputType.Equals("jpg"))
                {
                    imageOptionsBase = new JpegOptions();
                }
                else if (outputType.Equals("png"))
                {
                    imageOptionsBase = new PngOptions();
                }
                else if (outputType.Equals("gif"))
                {
                    imageOptionsBase = new GifOptions();
                }
                else if (outputType.Equals("svg"))
                {
                    imageOptionsBase = new SvgOptions();
                }
                return(ProcessTask(fileName, folderName, "." + outputType, false, false, delegate(string inFilePath, string outPath, string zipOutFolder)
                {
                    using (Aspose.CAD.Image image = Aspose.CAD.Image.Load(inFilePath))
                    {
                        image.Save(outPath, imageOptionsBase);
                    }
                }));
            }


            return(new Response
            {
                FileName = null,
                Status = "Output type not found",
                StatusCode = 500
            });
        }
        public static void Run()
        {
            // ExStart:DrawingUsingGraphicsPath
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Create an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();
            ImageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            ImageOptions.Source = new FileCreateSource(dataDir + "sample_1.bmp", false);

            // Create an instance of Image and initialize an instance of Graphics
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                Graphics graphics = new Graphics(image);
                graphics.Clear(Color.White);

                // Create an instance of GraphicsPath and Instance of Figure, add EllipseShape, RectangleShape and TextShape to the figure
                GraphicsPath graphicspath = new GraphicsPath();
                Figure figure = new Figure();
                figure.AddShape(new EllipseShape(new RectangleF(0, 0, 499, 499)));
                figure.AddShape(new RectangleShape(new RectangleF(0, 0, 499, 499)));
                figure.AddShape(new TextShape("Aspose.Imaging", new RectangleF(170, 225, 170, 100), new Font("Arial", 20), StringFormat.GenericTypographic));
                graphicspath.AddFigures(new[] { figure });
                graphics.DrawPath(new Pen(Color.Blue), graphicspath);

                // Create an instance of HatchBrush and set its properties also Fill path by supplying the brush and GraphicsPath objects
                HatchBrush hatchbrush = new HatchBrush();
                hatchbrush.BackgroundColor = Color.Brown;
                hatchbrush.ForegroundColor = Color.Blue;
                hatchbrush.HatchStyle = HatchStyle.Vertical;
                graphics.FillPath(hatchbrush, graphicspath);
                image.Save();
                Console.WriteLine("Processing completed successfully.");
            }
            // ExEnd:DrawingUsingGraphicsPath
        }
        public static void Run()
        {
            // ExStart:DrawingBezier
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();
 
            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir + "DrawingBezier_out.bmp", FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions and Create an instance of Image
                saveOptions.Source = new StreamSource(stream);
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class and clear Graphics surface
                    Graphics graphic = new Graphics(image);
                    graphic.Clear(Color.Yellow);

                    // Initializes the instance of PEN class with black color and width
                    Pen BlackPen = new Pen(Color.Black, 3);
                    float startX = 10;
                    float startY = 25;
                    float controlX1 = 20;
                    float controlY1 = 5;
                    float controlX2 = 55;
                    float controlY2 = 10;
                    float endX = 90;
                    float endY = 25;

                    // Draw a Bezier shape by specifying the Pen object having black color and co-ordinate Points and save all changes.
                    graphic.DrawBezier(BlackPen, startX, startY, controlX1, controlY1, controlX2, controlY2, endX, endY);
                    image.Save();
                }
            }
            // ExEnd:DrawingBezier
        }
Пример #31
0
        public static void Run()
        {
            Console.WriteLine("Running example ExtractTIFFFramesToBMPImageFormat");
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            using (TiffImage multiImage = (TiffImage)Image.Load(dataDir + "SampleTiff1.tiff"))
            {
                // Create an instance of int to keep track of frames in TiffImage
                int frameCounter = 0;

                // Iterate over the TiffFrames in TiffImage
                foreach (TiffFrame tiffFrame in multiImage.Frames)
                {
                    multiImage.ActiveFrame = tiffFrame;

                    // Load Pixels of TiffFrame into an array of Colors
                    Color[] pixels = multiImage.LoadPixels(tiffFrame.Bounds);

                    // Create an instance of bmpCreateOptions
                    BmpOptions bmpCreateOptions = new BmpOptions();
                    bmpCreateOptions.BitsPerPixel = 24;

                    // Set the Source of bmpCreateOptions as FileCreateSource by specifying the location where output will be saved
                    bmpCreateOptions.Source = new FileCreateSource(string.Format("{0}\\ConcatExtractTIFFFramesToBMP_out{1}.bmp", dataDir, frameCounter), false);

                    // Create a new bmpImage
                    using (BmpImage bmpImage = (BmpImage)Image.Create(bmpCreateOptions, tiffFrame.Width, tiffFrame.Height))
                    {
                        // Save the bmpImage with pixels from TiffFrame
                        bmpImage.SavePixels(tiffFrame.Bounds, pixels);
                        bmpImage.Save();
                    }
                    frameCounter++;
                }
            }

            Console.WriteLine("Finished example ExtractTIFFFramesToBMPImageFormat");
        }
Пример #32
0
        ///<Summary>
        /// ConvertPSDToImageFiles method to convert psd to image
        ///</Summary>
        public Response ConvertPSDToImageFiles(string fileName, string folderName, string outputType)
        {
            if (outputType.Equals("bmp") || outputType.Equals("jpg") || outputType.Equals("png"))
            {
                ImageOptionsBase optionsBase = new BmpOptions();

                if (outputType.Equals("jpg"))
                {
                    optionsBase = new JpegOptions();
                }
                else if (outputType.Equals("png"))
                {
                    optionsBase = new PngOptions();
                }
                else if (outputType.Equals("gif"))
                {
                    optionsBase = new GifOptions();
                }


                return(ProcessTask(fileName, folderName, "." + outputType, true, false, delegate(string inFilePath, string outPath, string zipOutFolder)
                {
                    string fileExtension = Path.GetExtension(inFilePath).ToLower();

                    using (Image image = Image.Load(inFilePath))
                    {
                        image.Save(outPath, optionsBase);
                    }
                }));
            }

            return(new Response
            {
                FileName = null,
                Status = "Output type not found",
                StatusCode = 500
            });
        }
        public static void Run()
        {
            // ExStart:ExtractTIFFFramesToBMPImageFormat
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_ModifyingAndConvertingImages();

            using (TiffImage multiImage = (TiffImage)Image.Load(dataDir + "SampleTiff1.tiff"))
            {
                // Create an instance of int to keep track of frames in TiffImage
                int frameCounter = 0;

                // Iterate over the TiffFrames in TiffImage
                foreach (TiffFrame tiffFrame in multiImage.Frames)
                {
                    multiImage.ActiveFrame = tiffFrame;

                    // Load Pixels of TiffFrame into an array of Colors
                    Color[] pixels = multiImage.LoadPixels(tiffFrame.Bounds);

                    // Create an instance of bmpCreateOptions
                    BmpOptions bmpCreateOptions = new BmpOptions();
                    bmpCreateOptions.BitsPerPixel = 24;

                    // Set the Source of bmpCreateOptions as FileCreateSource by specifying the location where output will be saved
                    bmpCreateOptions.Source = new FileCreateSource(string.Format("{0}\\ConcatExtractTIFFFramesToBMP_out{1}.bmp", dataDir, frameCounter), false);
                    
                    // Create a new bmpImage
                    using (BmpImage bmpImage = (BmpImage)Image.Create(bmpCreateOptions, tiffFrame.Width, tiffFrame.Height))
                    {
                        // Save the bmpImage with pixels from TiffFrame
                        bmpImage.SavePixels(tiffFrame.Bounds, pixels);
                        bmpImage.Save();
                    }
                    frameCounter++;
                }
            }
            // ExEnd:ExtractTIFFFramesToBMPImageFormat
        }
Пример #34
0
        public static void Run()
        {
            Console.WriteLine("Running example SVGToBMPConversion");

            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_SVG();

            using (Image image = Image.Load(dataDir + "test.svg"))
            {
                BmpOptions options = new BmpOptions();
                SvgRasterizationOptions svgOptions = new SvgRasterizationOptions();

                svgOptions.PageWidth  = 100;
                svgOptions.PageHeight = 200;


                options.VectorRasterizationOptions = svgOptions;

                image.Save(dataDir + "test.svg_out.bmp", options);
            }

            Console.WriteLine("Finished example SVGToBMPConversion");
        }
        public static void Run()
        {
            // ExStart:DrawingRectangle
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages() + "SampleRectangle_out.bmp";

            // Creates an instance of FileStream
            using (FileStream stream = new FileStream(dataDir, FileMode.Create))
            {
                // Create an instance of BmpOptions and set its various properties
                BmpOptions saveOptions = new BmpOptions();
                saveOptions.BitsPerPixel = 32;

                // Set the Source for BmpOptions
                saveOptions.Source = new StreamSource(stream);

                // Create an instance of Image
                using (Image image = Image.Create(saveOptions, 100, 100))
                {
                    // Create and initialize an instance of Graphics class
                    Graphics graphic = new Graphics(image);

                    // Clear Graphics surface
                    graphic.Clear(Color.Yellow);

                    // Draw a rectangle shape by specifying the Pen object having red color and a rectangle structure
                    graphic.DrawRectangle(new Pen(Color.Red), new Rectangle(30, 10, 40, 80));

                    // Draw a rectangle shape by specifying the Pen object having solid brush with blue color and a rectangle structure
                    graphic.DrawRectangle(new Pen(new SolidBrush(Color.Blue)), new Rectangle(10, 30, 80, 40));

                    // save all changes.
                    image.Save();
                }
            }
            // ExEnd:DrawingRectangle
        }
        public static void Run()
        {
            // ExStart:CreatingImageUsingStream
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Creates an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();
            ImageOptions.BitsPerPixel = 24;

            // Create an instance of System.IO.Stream
            Stream stream = new FileStream(dataDir + "sample_out.bmp", FileMode.Create);

            // Define the source property for the instance of BmpOptions Second boolean parameter determines if the Stream is disposed once get out of scope
            ImageOptions.Source = new StreamSource(stream, true);

            // Creates an instance of Image and call Create method by passing the BmpOptions object
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                // Do some image processing
                image.Save(dataDir + "CreatingImageUsingStream_out.bmp");
            }
            // ExEnd:CreatingImageUsingStream
        }
        ///<Summary>
        /// ConvertImageFormat method to convert image to different image formats
        ///</Summary>
        public Response ConvertImageFormat(string fileName, string folderName, string outputType)
        {
            if (outputType.Equals("gif") || outputType.Equals("bmp") || outputType.Equals("jpg") || outputType.Equals("png") ||
                outputType.Equals("psd") || outputType.Equals("emf") || outputType.Equals("svg") || outputType.Equals("wmf"))
            {
                ImageOptionsBase optionsBase = new BmpOptions();

                if (outputType.Equals("jpg"))
                {
                    optionsBase = new JpegOptions();
                }
                else if (outputType.Equals("png"))
                {
                    optionsBase = new PngOptions();
                }
                else if (outputType.Equals("gif"))
                {
                    optionsBase = new GifOptions();
                }
                else if (outputType.Equals("psd"))
                {
                    optionsBase = new PsdOptions();
                }
                else if (outputType.Equals("emf"))
                {
                    optionsBase = new EmfOptions();
                }
                else if (outputType.Equals("svg"))
                {
                    optionsBase = new SvgOptions();
                }
                else if (outputType.Equals("wmf"))
                {
                    optionsBase = new WmfOptions();
                }
                return(ProcessTask(fileName, folderName, "." + outputType, true, true, delegate(string inFilePath, string outPath, string zipOutFolder)
                {
                    string fileExtension = Path.GetExtension(inFilePath).ToLower();
                    if ((fileExtension == ".tif") || (fileExtension == ".tiff"))
                    {
                        string outfileName = Path.GetFileNameWithoutExtension(fileName) + "_{0}";
                        using (TiffImage multiImage = (TiffImage)Image.Load(inFilePath))
                        {
                            if (multiImage.Frames.Length > 1)
                            {
                                int frameCounter = 0;
                                // Iterate over the TiffFrames in TiffImage
                                foreach (TiffFrame tiffFrame in multiImage.Frames)
                                {
                                    multiImage.ActiveFrame = tiffFrame;
                                    // Load Pixels of TiffFrame into an array of Colors
                                    Color[] pixels = multiImage.LoadPixels(tiffFrame.Bounds);
                                    // Create an instance of JpegOptions

                                    // Set the Source of JpegOptions as FileCreateSource by specifying the location where output will be saved
                                    // Last boolean parameter denotes isTemporal
                                    outPath = zipOutFolder + "/" + outfileName;

                                    optionsBase.Source = new FileCreateSource(string.Format(outPath, frameCounter + 1) + "." + outputType, false);
                                    // Create a new RasterImage of Jpeg type
                                    using (var jpgImage = (RasterImage)Image.Create(optionsBase, tiffFrame.Width, tiffFrame.Height))
                                    {
                                        // Save the JpegImage with pixels from TiffFrame
                                        jpgImage.SavePixels(tiffFrame.Bounds, pixels);
                                        // Resize the Jpeg Image
                                        jpgImage.Resize(100, 100, ResizeType.NearestNeighbourResample);
                                        // Save the results on disk
                                        jpgImage.Save();
                                    }
                                    frameCounter++;
                                }
                            }
                            else
                            {
                                multiImage.Save(outPath, optionsBase);
                            }
                        }
                    }
                    else

                    {
                        using (Image image = Image.Load(inFilePath))
                        {
                            image.Save(outPath, optionsBase);
                        }
                    }
                }));
            }

            return(new Response
            {
                FileName = null,
                Status = "Output type not found",
                StatusCode = 500
            });
        }
        public static void Run()
        {
            // ExStart:DrawingUsingGraphicsPath
            // The path to the documents directory.
            string dataDir = RunExamples.GetDataDir_DrawingAndFormattingImages();

            // Create an instance of BmpOptions and set its various properties
            BmpOptions ImageOptions = new BmpOptions();

            ImageOptions.BitsPerPixel = 24;

            // Create an instance of FileCreateSource and assign it to Source property
            ImageOptions.Source = new FileCreateSource(dataDir + "sample_1.bmp", false);

            // Create an instance of Image
            using (Image image = Image.Create(ImageOptions, 500, 500))
            {
                // Create and initialize an instance of Graphics
                Graphics graphics = new Graphics(image);

                // Clear the image surface with white color
                graphics.Clear(Color.White);

                // Create an instance of GraphicsPath
                GraphicsPath graphicspath = new GraphicsPath();

                // Create an instance of Figure
                Figure figure = new Figure();

                // Add EllipseShape to the figure by defining boundary Rectangle
                figure.AddShape(new EllipseShape(new RectangleF(0, 0, 499, 499)));

                // Add RectangleShape to the figure
                figure.AddShape(new RectangleShape(new RectangleF(0, 0, 499, 499)));

                // Add TextShape to the figure by defining the boundary Rectangle and Font
                figure.AddShape(new TextShape("Aspose.Imaging", new RectangleF(170, 225, 170, 100), new Font("Arial", 20), StringFormat.GenericTypographic));

                // Add figures to the GraphicsPath object
                graphicspath.AddFigures(new[] { figure });

                // Draw Path
                graphics.DrawPath(new Pen(Color.Blue), graphicspath);

                // Create an instance of HatchBrush and set its properties
                HatchBrush hatchbrush = new HatchBrush();
                hatchbrush.BackgroundColor = Color.Brown;
                hatchbrush.ForegroundColor = Color.Blue;
                hatchbrush.HatchStyle      = HatchStyle.Vertical;

                // Fill path by supplying the brush and GraphicsPath objects
                graphics.FillPath(hatchbrush, graphicspath);

                // Save the changes.
                image.Save();

                // Display Status.
                Console.WriteLine("Processing completed successfully.");
            }
            // ExEnd:DrawingUsingGraphicsPath
        }