How to know if Successful Conversion

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
SIDDARTH

How to know if Successful Conversion

Post 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.
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: How to know if Successful Conversion

Post 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
SIDDARTH

Re: How to know if Successful Conversion

Post 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 :(
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to know if Successful Conversion

Post 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.)
snibgo's IM pages: im.snibgo.com
SIDDARTH

Re: How to know if Successful Conversion

Post 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.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to know if Successful Conversion

Post 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.
snibgo's IM pages: im.snibgo.com
SIDDARTH

Re: How to know if Successful Conversion

Post by SIDDARTH »

I tried removing convert already,But it did not help me.

Thanks.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to know if Successful Conversion

Post by snibgo »

What error message did you get?
snibgo's IM pages: im.snibgo.com
SIDDARTH

Re: How to know if Successful Conversion

Post 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 :(
Post Reply