我需要将tif转换为webp,并且我正在使用此项目中的wep包装器类-https://github.com/JosePineiro/WebP-wrapper/blob/master/WebPTest/WebPWrapper.cs
如果我使用常规的for循环,那么一切似乎都可以正常运行,但是我需要加快过程,这就是为什么我对每个人使用并行执行此方法的原因。在某些情况下,我的内存不足异常。我该如何避免呢?我读到可以使用long memorySize = currentProcess.PrivateMemorySize64
这是最佳做法吗?我从未使用过这种方法。
我像这样循环播放
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);
});