Simple image operations for .NET Core 6 and beyond
It depends on which platform you are building your app, but SkiaSharp 2.80.2 or 2.80.3 can be a good choice. There are quite a bit problems in newer packages, so you need to be careful which version you install so that you do not run into performance problems or bugs.
How to create thumbnail image in .net core? Using the help of IFormFile
Finally got the answer
Installed System.Drawing.Common -Version 4.5.1
package
Open the package manager and run the below code for installing the package
Install-Package System.Drawing.Common -Version 5.0.2
Then use the below code:
using System.Drawing;
var stream = ProductImage.OpenReadStream();
var newImage = GetReducedImage(32,32,stream);
newImage.Save("path+filename");
public Image GetReducedImage(int width, int height, Stream resourceImage)
{
try
{
var image = Image.FromStream(resourceImage);
var thumb = image.GetThumbnailImage(width, height, () => false, IntPtr.Zero);
return thumb;
}
catch (Exception e)
{
return null;
}
}
Related Topics
Get the Object Is Null Using JSON in Wcf Service
How to Download/Upload Files From/To Sharepoint 2013 Using Csom
Wpf Listview: Attaching a Double-Click (On an Item) Event
Wpf/C#: Where Should I Be Saving User Preferences Files
Loop Through All Controls on ASP.NET Webpage
How to Find Reason of Failed Build Without Any Error or Warning
Find Image Format Using Bitmap Object in C#
Determine Client's Computer Name
ASP.NET Is There a Better Way to Find Controls That Are Within Other Controls
How to Loop Over the Properties of a Class
Initializing an Array of Structs in C#
Best Way to Switch Behavior Based on Type
Peculiar Overload Resolution with While (True)
MVC HTML.Beginform Different Url Schema
Collection Was Modified; Enumeration May Not Execute Error When Removing a Listitem from a Listbox