I need to convert tif to webp and I am using wep wrapper class from this project - https://github.com/JosePineiro/WebP-wrapper/blob/master/WebPTest/WebPWrapper.cs
If I use regular for loop everything seems to be working correctly but I need to sped up the process and that is why I am using parallel for each to execute this method. I am getting out of memory exception in some cases. How can I avoid that? I was reading that I can use long memorySize = currentProcess.PrivateMemorySize64
Is this the best practice? I have never used this approach.
And I am looping it like:
Parallel.ForEach(MyList, (row) =>
{
byte[] rawWebP;
Image image = Image.FromFile(row.linkToImage);
Bitmap bmp = (Bitmap)image;
using (WebP webp = new WebP())
rawWebP = webp.EncodeLossless(bmp, row.linkToImage);
});