Page 1 of 1

How to know if Successful Conversion

Posted: 2010-06-22T10:09:38-07:00
by SIDDARTH
I am using the tool provided here to convert----->ImageMagick-6.6.2-Q16-windows.zip

I have been able to successfully convert PDF to Tif using .NET

How do i know when a tiff has been sucessfully converted or not.

This is my Command
----------------------------------------------------------------------------------------------------------------------------------
convert -verbose -units PixelsPerInch -density 300x300 -compress Group4 "SOURCE FILE PATH" "DESTINATION FILE PATH"
----------------------------------------------------------------------------------------------------------------------------------

Although i am able to convert PDF to TIF sucesfully i am getting this error.I am able to view it perfectly.
But since i am using Imagemagick in code,apart from the o/p conversion code it is also giving an error message.

Error Message
---------------------------------------------------------------------------------------------------------------------------------
"convert.exe: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2498.convert.exe: no decode delegate for this image format `convert' @ error/constitute.c/ReadImage/532."
---------------------------------------------------------------------------------------------------------------------------------

so i wanted to know when a PDF is converted ,whether its a sucessful conversion or not.Does imagemagick log it in anywhere or any other way to find?
Or the only way is to view & compare the file (PDF & TIF)

Kindly Help me.

Re: How to know if Successful Conversion

Posted: 2010-06-22T11:00:26-07:00
by fmw42
try


convert -quiet -regard-warnings input ... output ||
echo "--- FILE DOES NOT EXIST OR IS NOT AN ORDINARY FILE, NOT READABLE OR HAS ZERO SIZE ---"

or whatever message you want to show.

http://www.imagemagick.org/Usage/basics/#controls

Re: How to know if Successful Conversion

Posted: 2010-06-22T11:32:07-07:00
by SIDDARTH
I am still Unable to supress the Error message.(Although I am able to see the output perfectly.)

Is there anyway i can supress it? and

How do i know a sucessfull Conversion.Is it by Manually Comparing or any other way that IM has??

Command Used
----------------------------

convert -quiet -verbose -units PixelsPerInch -density 300x300 -compress Group4 "Source File Path" "Dest File Path"

and

convert -verbose -units PixelsPerInch -density 300x300 -compress Group4 -quiet "Source File Path" "Dest File Path"

----------------------------

Thank you.
Kindly Help :(

Re: How to know if Successful Conversion

Posted: 2010-06-22T14:34:11-07:00
by snibgo
Read the error message:
"convert.exe: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2498.convert.exe: no decode delegate for this image format `convert' @ error/constitute.c/ReadImage/532."
convert.exe is looking for an image file called "convert". So something is wrong with the command line. Post the actual code you are using.

(Cross-posting in Users and Developers forums isn't helpful.)

Re: How to know if Successful Conversion

Posted: 2010-06-23T07:11:53-07:00
by SIDDARTH
Here is the piece of code you asked:

-----------------------------------------

StringBuilder cmd = new StringBuilder();


cmd.Append("convert -verbose -units PixelsPerInch -density 300x300 -compress Group4 ");
cmd.Append("\""+sourcePath + sourceFilename +"\" ");
cmd.Append("\"" + destinationPath + DestinationFilename +"\" ");

System.Diagnostics.ProcessStartInfo psi = new System.Diagnostics.ProcessStartInfo("ImageMagickPath to convert.exe");
psi.Arguments = cmd.ToString();
psi.UseShellExecute = false;
psi.RedirectStandardOutput = true;
psi.RedirectStandardInput = true;
psi.RedirectStandardError = true;

// Start the process
System.Diagnostics.Process proc = System.Diagnostics.Process.Start(psi);
StreamReader Error = proc.StandardError;
StreamReader sr = proc.StandardOutput;

proc.WaitForExit();

StringBuilder output = new StringBuilder();
StringBuilder ErrorMessage = new StringBuilder();

while (sr.Peek() != -1)
{

output.Append(sr.ReadLine());

}

while (Error.Peek() != -1)
{

ErrorMessage.Append(Error.ReadLine());

}

proc.Close();

----------------------------------------

As already mentioned, On a successful conversion it shows that there is a an error(can see converted images perfectly), although i dont get any when i use the command in my cmd.exe manually.
On Successful conversion i get the ErrorMessage and output.

i) So how do i know whether a successful conversion has happened.
ii) How can i supress the error message
iii) how can we find a conversion has happened sucessfully meaning the tiff is same as pdf.Is it only by manual comparision or any other way in Imagemagick.

---my aplologies for cross posting

Kindly help :(
Thank you.

Re: How to know if Successful Conversion

Posted: 2010-06-23T07:23:04-07:00
by snibgo
It looks as if you are calling convert.exe, giving it the arguments "convert -verbose -units PixelsPerInch" etc. So removing "convert" from the arguments might help.

You can use ImageMagick "compare" to compare two images. It returns a number, where zero means the images are identical.

Re: How to know if Successful Conversion

Posted: 2010-06-23T07:29:15-07:00
by SIDDARTH
I tried removing convert already,But it did not help me.

Thanks.

Re: How to know if Successful Conversion

Posted: 2010-06-23T08:49:20-07:00
by snibgo
What error message did you get?

Re: How to know if Successful Conversion

Posted: 2010-06-23T08:52:30-07:00
by SIDDARTH
As already said,I have this error message on successful conversion
--------------------------------------------
"convert.exe: unable to open image `convert': No such file or directory @ error/blob.c/OpenBlob/2498.convert.exe: no decode delegate for this image format `convert' @ error/constitute.c/ReadImage/532."
--------------------------------------------


Thanks :(