Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Converting MagicImageCollection to Base64 in parallel

$
0
0
I have a collection of images I need to convert to PNG, then to Base64. Iterating through the collection one at a time takes about a second per image for the conversion to string. I tried to use PLINQ to do the conversion like this:
                returnImage.AsParallel().ForAll(test => test.Format=MagickFormat.Png);
                returnImage.AsParallel().AsOrdered().ForAll(test => test.ToBase64());
And the setting to PNG works fine, the ToBase64 throws an error:
An exception of type 'System.ArgumentNullException' occurred in GraphicsMagick.NET-AnyCPU.dll but was not handled in user code

Value cannot be null.\r\nParameter name: inArray

Can parallelism be used with MagicImageCollection? and if not, does anyone know of a way to make that conversion to base64 faster?

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>