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

New Post: Magick.NET-7.0.0.0009-Q16-x64-net40-client Freezing System

$
0
0
I've been trying to resize the image - I have read the image size - and yes they're huge. I can read the info, but the minute I try and get the image, everything freezes - I'm clearly doing something wrong, I'm just not sure what, maybe there's a size limitation I don't know about - here's my code:

// Read SVG image from file
            MagickNET.SetTempDirectory(Path.GetDirectoryName(sourceName.Value.ToString()));
            MagickImageInfo info = new MagickImageInfo(sourceName.Value.ToString());
            debugLoc = "Reading Image Info";

            iwide = info.Width;
            iheight = info.Height;

            debugLoc = "Getting image";
            using (MagickImage image = new MagickImage(sourceName.Value.ToString()))
            // 
            {  
                //resize if any dimension is larger than 5,000
                debugLoc = "Checking Size";
                if (iwide > 5000 || iheight > 5000)
                {
                    dWide = iwide / 25;
                    dHeight = iheight / 25;

                    dWide = Math.Round(dWide, 0, MidpointRounding.AwayFromZero);
                    dHeight = Math.Round(dHeight, 0, MidpointRounding.AwayFromZero);

                    wide = Convert.ToInt32(dWide);
                    height = Convert.ToInt32(dHeight);
                    debugLoc = "Resizing Image";
                    image.Resize(wide, height);
                }

                image.Format = (MagickFormat)Enum.Parse(typeof(MagickFormat), fileType.Value.ToString(), true);
                image.Write(string.Concat(targetName.Value.ToString(), ".", fileType.Value.ToString()));
            }
``` Not sure what I need to do - the file is an SVG file if that makes any difference.

Thanks

Viewing all articles
Browse latest Browse all 3693

Trending Articles



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