Image cut in half when converting PDF to PNG with -resize

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
avheatherim
Posts: 1
Joined: 2011-06-06T13:51:53-07:00
Authentication code: 8675308
Contact:

Image cut in half when converting PDF to PNG with -resize

Post by avheatherim »

I am using image magick with C# to convert a pdf with an upload tool I built. Works amazing for all pdfs until today.

A user uploaded a pdf and it converts & resizes, but cuts it in half!

Has anyone else heard of this?

Here is my code:

Code: Select all

             //restrict image size to 200 pixels
                string newSize = "200x200 ";
                string opt = " -resize " + newSize;

                // setup a process to run the ImageMagick converter
                pdfToPngProcess.StartInfo.UseShellExecute = false;
                pdfToPngProcess.StartInfo.CreateNoWindow = true;
                pdfToPngProcess.StartInfo.RedirectStandardError = true;
                pdfToPngProcess.StartInfo.RedirectStandardOutput = true;
                pdfToPngProcess.StartInfo.FileName = AppDomain.CurrentDomain.BaseDirectory + @"\Scripts\ImageMagick\convert.exe";

                // quote filenames so we don't have to worry about spaces in file paths
                pdfToPngProcess.StartInfo.Arguments = string.Format(@"""{0}"" {1} ""{2}""", sourcePDFPath, opt, destinationFullPath);

                //// attempt to convert the images and wait until it completes
                pdfToPngProcess.Start();
                pdfToPngProcess.WaitForExit();
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W
Contact:

Re: Image cut in half when converting PDF to PNG with -resiz

Post by glennrp »

Which half of the image are you seeing (top, bottom, left, right) and what
are its dimensions? What version of IM and libpng are you using?
Post Reply

Who is online

Users browsing this forum: Semrush [Bot] and 27 guests