Image Magick Black bars coming

Magick.NET is an object-oriented C# interface to ImageMagick. Use this forum to discuss, make suggestions about, or report bugs concerning Magick.NET
Post Reply
prohitkumar894
Posts: 1
Joined: 2016-06-14T03:31:48-07:00
Authentication code: 1151

Image Magick Black bars coming

Post 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);
            }
        }
User avatar
dlemstra
Posts: 1570
Joined: 2013-05-04T15:28:54-07:00
Authentication code: 6789
Contact:

Re: Image Magick Black bars coming

Post by dlemstra »

Can you reproduce the black bars issue or does it happen occasionally?
.NET + ImageMagick = Magick.NET https://github.com/dlemstra/Magick.NET, @MagickNET, Donate
Post Reply