Convert Image to JPG in C#
PowerPoint .NET API for converting Images to JPG pictures on NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms
Convert Image to JPG in C#
How do I convert Image to JPG in code?
Using Aspose.Slides for .NET , any developer or application can convert an image to a JPG picture with just a few lines of C# code.
As a modern document processing API, Aspose.Slides for .NET exports images in popular formats to JPG quickly. Aspose PowerPoint library allows you to convert images to JPG and many other image formats.
To install Aspose.Slides: Open NuGet package manager. Search for Aspose.Slides and install it.
Or you can install Aspose.Slides by running this command from the Package Manager Console.
Package Manager Console Command
PM> Install-Package Aspose.Slides.NET
How to Convert Image to JPG in C#
Developers and applications can convert Image to JPG this way:
Create an instance of the Presentation class.
Load the Image file.
Add a picture frame.
Save the file as a JPG image.
System Requirements
Before you run the Image to JPG conversion C# code, your machine must have these prerequisities:
- Microsoft Windows or a compatible OS with .NET Framework, .NET Core, Windows Azure, Mono or Xamarin Platforms.
- Development environment like Microsoft Visual Studio.
- Aspose.Slides for .NET DLL has been referenced in your project.
C# code to convert Image to JPG
using (Presentation pres = new Presentation())
{
IPPImage image = pres.Images.AddImage(File.ReadAllBytes(imagePath));
pres.Slides[0].Shapes.AddPictureFrame(ShapeType.Rectangle, 0, 0, 720, 540, image);
pres.Slides[0].GetThumbnail(new Size(960, 720)).Save($"image.jpg", ImageFormat.Jpeg);
}
Free Online Converter
Other Supported Conversions
Aspose.Slides supports conversion operations for many file formats