Page 1 of 1

Image Magick Black bars coming

Posted: 2016-06-14T03:42:10-07:00
by prohitkumar894
Hi Guys,

I am using ImageMagick dll in my ASP.NET MVC application. In our case we are getting SVG images from UI after that in the backend we are converting SVG to PDF in C# using ImageMagick. But some times I am getting black Bars. Any solution for this.

Code: Select all

public void SVGtoPDF(string svg, string pdf)
        {
            string text = System.IO.File.ReadAllText(svg);
            byte[] bytes = Encoding.UTF8.GetBytes(text);
            MagickReadSettings settings = new MagickReadSettings()
            {
                Density = new PointD(3000, 3000),
                //ColorSpace= ColorSpace.RGB,
                Format = MagickFormat.Svg
            };

            string pdfFileName = pdf;

            using (MagickImage image = new MagickImage(bytes, settings))
            {
                MagickImage i = new MagickImage();
                //image.ColorSpace = ColorSpace.RGB;
                image.Format = MagickFormat.Pdf;
                image.Density = new PointD(150, 150);
                image.CompressionMethod = CompressionMethod.JPEG;
                image.Resize(1240, 1753);
                image.ResolutionUnits = Resolution.PixelsPerInch;
                image.Write(pdfFileName);
            }
        }

Re: Image Magick Black bars coming

Posted: 2016-06-14T11:40:31-07:00
by dlemstra
Can you reproduce the black bars issue or does it happen occasionally?