Last active
September 10, 2021 10:00
-
-
Save aspose-com-kb/1f1ccb016f639eca7b859c34a34b9109 to your computer and use it in GitHub Desktop.
Create PNG Image from BMP in C#. More details and explanation can be found here https://kb.aspose.com/imaging/net/how-to-create-png-image-from-bmp-in-c-sharp/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| using System; | |
| //Use following namespaces to create PNG image | |
| using Aspose.Imaging; | |
| using Aspose.Imaging.ImageOptions; | |
| namespace CreatePNGImage | |
| { | |
| class Program | |
| { | |
| static void Main(string[] args) | |
| { | |
| //Set license before creating PNG image from BMP | |
| Aspose.Imaging.License AsposeImagingLicense = new Aspose.Imaging.License(); | |
| AsposeImagingLicense.SetLicense(@"c:\asposelicense\license.lic"); | |
| //load input BMP image | |
| Image BmpToPngImage = Image.Load("InputBMPImage.bmp"); | |
| //set attributes of the output PNG file | |
| PngOptions PNGImageOptions = new PngOptions(); | |
| PNGImageOptions.ResolutionSettings = new ResolutionSetting(300, 300); | |
| PNGImageOptions.CompressionLevel = 6; | |
| //save converted output PNG image | |
| BmpToPngImage.Save("OutputPNGImage.png", PNGImageOptions); | |
| } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment