This project has moved. For the latest updates, please go here.

MagickImage adds black line at top of image during svg to png/pdf conversation

Nov 26, 2015 at 6:12 AM
Hello,
I'm trying convert my svg to png/pdf.
while doing so it add black strips on the image.
Attached is the sample pdf which shows the issue. if just convert it to png only that also has same issue.

Attached is the sample pdf file link:
https://svcweufixtureclob.blob.core.windows.net/svc-weu-printjob/524f2935-b5a3-4f42-93b0-7ff524607249_113.pdf

Code:
//ToDo: Convert source SVG file to PDF, and update to dest folder.
                        string text = System.IO.File.ReadAllText(sourceFie);
                        byte[] bytes = Encoding.UTF8.GetBytes(text);
                        MagickNET.UseOpenCL = false;

                        MagickReadSettings settings = new MagickReadSettings()
                        {
                            Density = new PointD(3000, 3000),
                            ColorSpace= ColorSpace.RGB,
                            Format = MagickFormat.Svg
                        };

                        string pdfFileName = Path.ChangeExtension(destFileName, ".pdf");

                        using (MagickImage image = new MagickImage(bytes, settings))
                        {
                            image.ColorSpace = ColorSpace.RGB;
                            image.
                            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);                                
                        }
Coordinator
Nov 26, 2015 at 8:08 AM
What is your input image? And it looks like you are combining multiple images into one file?
Nov 26, 2015 at 8:23 AM
I'm trying to convert my svg file into PDF/PNG.
The one which you see is PDF file, which has Images and text alternatively
I do first convert the svg file into pdf and after all the svg's being converted finally i ll print the pdf with images an dtext alternatively.
Text pdf is nothing to do with this hence need not to be discussed over here.

Attaching the link to SVG. This is full svg. when we do send the we will break the svg into some protion, which comes correctly there is noting wrong into the given SVG portion.
https://svcweufixtureclob.blob.core.windows.net/svc-weu-thumbnail/f28da561-8263-4c01-9a14-99f5cdd83ea1_11833.svg

This issue is not constantly producible.
Coordinator
Nov 26, 2015 at 8:55 AM
Are you using the latest version of Magick.NET?
Nov 26, 2015 at 9:00 AM
Magick.NET-Q16-HDRI-AnyCPU.7.0.0.0019

This is what i got from nuget manager.
Coordinator
Nov 26, 2015 at 9:20 AM
Can you update to the latest version 7.0.0.0022 and try to reproduce the issue?
Nov 27, 2015 at 3:43 AM
I've tried its same behavior. One more thing with 7.0.0.0022 its shows that Could not load file or assembly 'Magick.NET.Wrapper-x64.DLL which was not the case with .0019
Coordinator
Nov 27, 2015 at 9:12 AM
Edited Nov 27, 2015 at 9:12 AM
How can you test it if you get the message Could not load file or assembly 'Magick.NET.Wrapper-x64.DLL
Coordinator
Nov 30, 2015 at 3:09 PM
I cannot reproduce your issue with the latest version of Magick.NET. Can you upgrade to 7.0.0.0022 and try it again? You will need to install the Visual C++ Redistributable for Visual Studio 2015 for this version.
Dec 2, 2015 at 8:36 AM
what if i m using VS2013 not 2015, will it work? And do i need to install only in Dev machine or in deployment machine also i need to install anything?
Coordinator
Dec 2, 2015 at 9:15 AM
You can use it together with VS2013. You do need to install the C++ redistributable on all machines where you want to use Magick.NET.
Dec 3, 2015 at 8:10 AM
I have tried the new version as well. The new version Q16-AnyCpu not HDRI.
https://svcweufixtureclob.blob.core.windows.net/svc-weu-printjob/100_blob.pdf
As proof i'm attaching the pdf page got generated after conversation. I'm not lying as you can check PDF properties and check for PDF producer which indicates the version and etc... and i got, this indicates its latest version. ImageMagick 7.0.0-0 Q16 x64 2015-11-23 http://www.imagemagick.org means generated through latest version of the DLL.
Coordinator
Dec 3, 2015 at 8:56 AM
What is your Ghostscript version? Maybe this version has a bug? And why are you installing ImageMagick 7.0.0-0? You should not do that when you use Magick.NET.
Dec 3, 2015 at 9:03 AM
Image magick software is not installed. This file has been generated through the Mgick.net DLL only. Hence as producer its showing this text " ImageMagick 7.0.0-0 Q16 x64 2015-11-23".
Which ghost script you are talking about. i haven't manually installed anything in machine.
Where/how i can see that thing
Coordinator
Dec 3, 2015 at 10:22 AM
Sorry my bad, you only need Ghostscript to read PDF files.

Can you create a small project that demonstrates this issue and share it on something like DropBox? I am still unable to reproduce the issue.
Dec 10, 2015 at 5:22 AM
I have tried and about to send the sample project. But what i found when its part of my async method it behaves wired. When i applied the mutex on code where i do invoke the magick.net it worked fine.

So its taking time when multiple user access the same feature but it works, so problem is its not thread safe.
Coordinator
Dec 10, 2015 at 9:24 AM
The threading issue should be resolved in the latest version of Magick.NET. Are you using the same image with multiple threads? A single MagickImage is not thread safe.