I am using LabVIEW command shell to execute the command line:
cmd /c convert -depth 8 -size 1500x13000 -density 800 gray:54_3.dat c:\Print_Quality_Project\VB_Test\54_3.jpg
and I got a return code of 1.
How do I find out what this return code means?
Command line - "Convert" - what is the return code?
Re: Command line - "Convert" - what is the return code?
I think 0 is success and 1 is fail.
Re: Command line - "Convert" - what is the return code?
But I do get return code of "4"..Bonzo wrote:I think 0 is success and 1 is fail.
Where can i find the source code for the command line tool, so that I could check all the return codes?
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Command line - "Convert" - what is the return code?
You asked for it!!!splee wrote:Where can i find the source code for the command line tool, so that I could check all the return codes?
The command 'main()' function is in "utilities/convert.c" Though in IMv7 that is being obsoleted for "utilities/magick.c".
This module is however simple a call to a 'wrapper' library function MagickCommandGenesis() which is used for some special options, such as "-bench" (process command multiple times reporting timings), but then that function forwards to the actual 'command' function that was given as a argument to MagickCommandGenesis().
For "convert" that function is ConvertImageCommand() and is located in "wand/convert.c". This is the function that does the task of actually figuring out how to process the argument array given.
Here is an example of calling this function directly...
Code: Select all
/*
Bare minimal test of a direct call to ConvertImageCommand()
Actually this is basically what the "convert" command does.
Compile with...
gcc -I/usr/include/ImageMagick -lMagickWand -lMagickCore \
convert_equiv.c -o convert_equiv
*/
#include <stdio.h>
#include "magick/studio.h"
#include "magick/exception.h"
#include "magick/exception-private.h"
#include "magick/image.h"
#include "wand/MagickWand.h"
#include "wand/convert.h"
int main(int argc, char **argv)
{
MagickCoreGenesis(argv[0],MagickFalse);
{
int arg_count;
char *args[] = { "program_name", "-size", "100x100", "xc:red",
"(", "rose:", "-rotate", "-90", ")",
"+append", "show:", NULL };
for(arg_count = 0; args[arg_count] != (char *)NULL; arg_count++);
ImageInfo *image_info = AcquireImageInfo();
ExceptionInfo *exception = AcquireExceptionInfo();
MagickBooleanType status =
ConvertImageCommand(image_info, args_count, args, NULL, exception);
if (exception->severity != UndefinedException)
{
status=MagickTrue;
CatchException(exception);
}
if (status == MagickFalse)
fprintf(stderr, "Error in call\n");
image_info=DestroyImageInfo(image_info);
exception=DestroyExceptionInfo(exception);
}
MagickCoreTerminus();
}
The function itself is however not straight forward and complex code due to the need to handle IMv5 Legacy handling. The bulk of the function can also be ignored to an extent as it simply contains syntax checking. The actual read operation code (in IMv6) is in "wand/mogrify.c" and is called using the FireImageStack() macro. -- I did say it was complex!
IMv7 "magick" on the other hand is much more straight forward. No 'macro' code, that hides alot of the processing. Its functions (in "MagicWand/magick-cli.c") first handle 'special' requirements (eg "-version" "-list" "-script" otpions) then calls either a ProcessCommandOptions() or a ProcessScriptOptions() to handle options from a argument array (command line) or from a file stream (script). It calls the appropriate functions in "MagickWand/operation.c" to actually process the options in terms of a special MagickWand structure.
This install handling is 'mostly settled' but could still have some changes as development proceeds. IMv7 handling will replace the old IMv6 option handling. And "magick" command replaces "convert".
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- whugemann
- Posts: 289
- Joined: 2011-03-28T07:11:31-07:00
- Authentication code: 8675308
- Location: Münster, Germany 52°N,7.6°E
Re: Command line - "Convert" - what is the return code?
I think that the actual value of the return code is of little help for your error diagnosis, see http://www.imagemagick.org/Usage/windows/#debugging. Instead, you should test your command line in a DOS box thoroughly before you launch it by another program. Please note that you don't need the cmd overhead in your example, a simple
would do just as well.
I though have to admit that I don't really understand what you are actually trying to do in this command line...
Code: Select all
convert -depth 8 -size 1500x13000 -density 800 gray:54_3.dat c:\Print_Quality_Project\VB_Test\54_3.jpg
I though have to admit that I don't really understand what you are actually trying to do in this command line...
Wolfgang Hugemann