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

New Post: ToBase64 is always different for same image

$
0
0
Yes,

Convert to Image TimeTaken = 5263

I am processing the PDF, with the following code, setting the UseOpenCL to false did not help, the processing time is still around 5 seconds

MagickNET.SetGhostscriptDirectory(ghostScriptLocation);
        MagickNET.UseOpenCL = false;
        int width = Convert.ToInt32(displayWidth);
        int height = Convert.ToInt32(displayHeight);
        var settings = new MagickReadSettings { Density = new PointD(defaultDpi) };
        using (var images = new MagickImageCollection())
        {
            //// Add all the pages of the pdf file to the collection
            images.Read(pdfDocumentInBytes, settings);

            ////int page = 1;

            Parallel.For(
                0,
                images.Count,
                delegate(int index)
                {
                    // ReSharper disable AccessToDisposedClosure
                    using (MagickImage pdfConvertedImage = images[index])
                    {
                        // ReSharper restore AccessToDisposedClosure
                        //// set the format of the image
                        pdfConvertedImage.Format = MagickFormat.Png;
                        pdfConvertedImage.Resize(new MagickGeometry(width, height));
                        var keyValuePair = new KeyValuePair<string, string>(
                                    string.Format(imageFolderPath + FilePng, index),
                                    pdfConvertedImage.ToBase64());
                        var imageHashKeyValuePair = new KeyValuePair<string, string>(
                            index.ToString(CultureInfo.InvariantCulture),
                            pdfConvertedImage.Signature);
                             imageCollection.Add(keyValuePair);
                        imageCollection.Add(imageHashKeyValuePair);
                    }
                });
        }

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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