The compression ratio can be up to 70%, but that depends on the image. The below image shows the size difference between both the images. String sFilePath = sOptimizedFile = source = Tinify.FromFile(sFilePath) Tinify.Key = API_KEY //TinyPNG Developer API KEY Just, provide the source image path to Tinify API and destination path. With two lines of code, image compression can be achieved. Using it for compression or resizing is very simple. To use with ASP.NET Core, first install the Tinify nuget package. You can find your API key on the TinyPNG developer dashboard. Provide your name and email address to get access of developer dashboard. You can get the pricing details from here. You can use different TinyPNG account after 500 images and continue with your compression free of charge or you can also opt for a paid subscription. It compresses first 500 images for free every month. The Tinify API allows you to compress and optimize JPEG and PNG images. The effect is nearly invisible but it makes a very large difference in file size! TinyPNG uses an algorithm to reduce the number of colors in a way that’s unnoticeable to the naked eye.īy selectively decreasing the number of colors in the image, fewer bytes are required to store the data. TinyPNG uses smart lossy compression techniques to reduce the file size of your PNG files. In this post, let’s find out how to compress and resize/scale images in ASP.NET Core using TinyPNG API.Ĭompress and Resize/Scale Images in ASP.NET Core Along with web interface, they also expose REST API (Free/Paid) to compress images on the fly. In fact, we always use TinyPNG to compress images, created for this blog. TinyPNG is a great place to compress JPEG or PNG images. Large size images are slow to load and optimizing them can reduce bandwidth and help your website load faster.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |