JPEG to PNG conversion

Aspose.Imaging Cloud is a complete image format processing REST API. It offers a plethora of options for Image processing and the details pertinent to the file formats it can handle can be found over Supported file formats. In this article, we are going to discuss some of the amazing features related to the inter-format conversion of popular images formats.

GIF to DICOM conversion

GIF image

The Graphical Interchange Format (GIF) is a type of bitmap image that has become popular dues to its high compression qualities. It is also one of the popular formats for users, looking for a way to animate images in the smallest file size. In short, GIFs are a series of images or soundless video that will loop continuously and doesn’t require anyone to press play. Therefore, due to its wide support and portability between applications and operating systems.

DICOM image

At the same time, Digital Imaging and Communications in Medicine (DICOM) is the standard for the communication and management of medical imaging information and related data. They can easily provide integration of medical imaging devices such as scanners, servers, workstations, printers, network hardware. So there can be a requirement to render the GIF images to DICOM format and in order to accomplish this feature, Aspose.Imaging cloud can be utilized. In the following steps, we are going to use Aspose.Imaging Cloud SDK for .NET which is developed on top of Aspose.Imaging Cloud.

So first thing first. Aspose.Imaging Cloud SDK for .NET can be installed from NuGet library using the following command on the package manager console

Install-Package Aspose.Imaging-Cloud -Version 21.2.0

You may also visit the following link for more information on How to install Aspose.Cloud SDKs.

Other than using .NET Cloud SDK, the Cloud API can also be accessed through the cURL command over the terminal to accomplish this requirement. However, in order to access the Cloud API, you need to generate a JWT access token as the APIs are only accessible to authorized users. For more information, please visit How to Obtain JWT token using a Client ID and Client Secret key.

cURL command

curl -v "https://api.aspose.cloud/v3.0/imaging/kite.gif/convert?format=DICOM" \
-X GET \
-H "Accept: application/json" \
-H "Authorization: Bearer <JWT Token>" \
-o /Users/nayyershahbaz/Documents/myResultant.dicom

In the code snippet given below, we are performing the GIF image to DICOM conversion using Aspose.Imaging Cloud SDK for .NET.

  • First of all, we need to create an object of ImagingApi bypassing ClientID and ClientSecret details as an input argument to the constructor.
  • Call the method ConvertImageRequest(..) bypassing source image, resultant format, folder, and storage as input arguments
  • Call the method ConvertImage(..) to perform the conversion
  • Finally, we will call the File.Create(..) method to save the output on a local drive.

C# .NET

The source images used in the above examples can be downloaded from

Convert JPEG to PNG

JPEG format

Joint Photographic Experts Group (JPEG) images are popular choices for storing and transmitting photographic images on the web. Almost all Operating systems now have viewers that support visualization of JPEG images. It is also a famous method of lossy compression enabling the users a selectable tradeoff between storage size and image quality. Owing to these capabilities, JPEG images are largely responsible for the proliferation of digital images and digital photos across the Internet, and later social media.

PNG format

Albeit JPEG is among the popular formats, but sometimes there is a requirement when particular applications only support Portable Network Graphics (PNG) format. The PNG format also a raster-graphics file format that supports lossless data compression maintaining detail and contrast between colors. In particular, PNG offers much better text readability than JPEG. This makes PNG a more popular choice for infographics, banners, screenshots, and other graphics that include both images and text. So in order to accomplish this requirement, you may try using the ConvertImage(..) method of Aspose.Imaging Cloud API.

cURL command - with Storage

curl -v "https://api.aspose.cloud/v3.0/imaging/Converter.jpg/convert?format=PNG" \
-X GET \
-H "Accept: application/json" \
-H "Authorization: Bearer <JWT Token>" \
-o /Users/nayyershahbaz/Documents/myResultant.png

Given below is the C# .NET code snippet offering the capabilities to render input JPEG image to PNG format.

C# .NET

Quick Tip

In order to view the image files, you may try using our Aspose.Imaging Viewer App which is 100 Free. No subscription or login required.

Conclusion

In this article, we have learned about the features of Aspose.Imaging Cloud API to inter-convert one image format to another format. The quick trick is that you can use the same ConvertImage(…) method to render any already available image to other supported format. Similary, use the CreateConvertedImage(…) method to load an image from input directory and render it to other supported formats i.e Convert JPEG to PNG etc. Similar to the conversion features mentioned above, the same method can be used to convert CDR to PNG and EMF to SVG conversion.