working on it ...

Filters

Explore Public Snippets

Sort by

Found 1 snippet matching: "creates new image canvas in jpeg"

    public by sherazam  4182  1  6  0

    How to Combine Two or Multiple Images into a Single Image inside .NET Apps

    This technical tip explains how .NET developers can combine single or multiple images inside their .NET applications. This example uses Graphics class and shows how to combine two or more images into a single complete image. To demonstrate the operation, the example creates a new Image canvas in JPEG format and draw images on the canvas surface us
    // Enter here the actual content of the snippet.            
    // Combining Images using Graphics Class
    
    //[C# Code Sample]
    
    //Create an instance of JpegOptions and set its various properties
    Aspose.Imaging.ImageOptions.JpegOptions ImageOptions = new Aspose.Imaging.ImageOptions.JpegOptions();
    
    //Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = new Aspose.Imaging.Sources.FileCreateSource(@"two_images_result.jpeg", false);
    
    //Create an instance of Image and define canvas size
    using (var image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600))
    {
          //Create and initialize an instance of Graphics
          var graphics = new Aspose.Imaging.Graphics(image);
    
          //Clear the image surface with white color
          graphics.Clear(Aspose.Imaging.Color.White);
    
          // Draw Image
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input1.jpg"), 0, 0, 600, 300);
          graphics.DrawImage(Aspose.Imaging.Image.Load(@"input2.jpg"), 0, 300, 600, 300);
                    
          // Call save method to save the resultant image.
          image.Save();
    }
     
    //[VB.NET Code Sample]
    
    'Create an instance of JpegOptions and set its various properties
    Dim ImageOptions As New Aspose.Imaging.ImageOptions.JpegOptions()
    
    'Create an instance of FileCreateSource and assign it to Source property
    ImageOptions.Source = New Aspose.Imaging.Sources.FileCreateSource("two_images_result.jpeg", False)
    
    'Create an instance of Image and define canvas size
    Using image = Aspose.Imaging.Image.Create(ImageOptions, 600, 600)
    	'Create and initialize an instance of Graphics
    	Dim graphics = New Aspose.Imaging.Graphics(image)
    
    	'Clear the image surface with white color
    	graphics.Clear(Aspose.Imaging.Color.White)
    
    	' Draw Image
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input1.jpg"), 0, 0, 600, 300)
    	graphics.DrawImage(Aspose.Imaging.Image.Load("input2.jpg"), 0, 300, 600, 300)
    
    	' Call save method to save the resultant image.
    	image.Save()
    End Using
    
    

    List Complete ( 1 snippet total )

    Cannot find what you were looking for?
    Ask the Snip2Code Community

    • Public Snippets
    • Channels Snippets