root / ImageMagick / branches / ImageMagick-6.3.5 / utilities / convert.c
| Revision 7647, 5.1 kB (checked in by cristy, 15 months ago) |
|---|
| Line | |
|---|---|
| 1 | /* |
| 2 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 3 | % % |
| 4 | % % |
| 5 | % % |
| 6 | % CCCC OOO N N V V EEEEE RRRR TTTTT % |
| 7 | % C O O NN N V V E R R T % |
| 8 | % C O O N N N V V EEE RRRR T % |
| 9 | % C O O N NN V V E R R T % |
| 10 | % CCCC OOO N N V EEEEE R R T % |
| 11 | % % |
| 12 | % % |
| 13 | % Convert an image from one format to another. % |
| 14 | % % |
| 15 | % Software Design % |
| 16 | % John Cristy % |
| 17 | % April 1992 % |
| 18 | % % |
| 19 | % % |
| 20 | % Copyright 1999-2007 ImageMagick Studio LLC, a non-profit organization % |
| 21 | % dedicated to making software imaging solutions freely available. % |
| 22 | % % |
| 23 | % You may not use this file except in compliance with the License. You may % |
| 24 | % obtain a copy of the License at % |
| 25 | % % |
| 26 | % http://www.imagemagick.org/script/license.php % |
| 27 | % % |
| 28 | % Unless required by applicable law or agreed to in writing, software % |
| 29 | % distributed under the License is distributed on an "AS IS" BASIS, % |
| 30 | % WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. % |
| 31 | % See the License for the specific language governing permissions and % |
| 32 | % limitations under the License. % |
| 33 | % % |
| 34 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 35 | % |
| 36 | % Convert converts an input file using one image format to an output file |
| 37 | % with a differing image format. By default, the image format is determined |
| 38 | % by its magic number. To specify a particular image format, precede the |
| 39 | % filename with an image format name and a colon (i.e. ps:image) or specify |
| 40 | % the image type as the filename suffix (i.e. image.ps). Specify file as - |
| 41 | % for standard input or output. If file has the extension .Z, the file is |
| 42 | % decoded with uncompress. |
| 43 | % |
| 44 | % |
| 45 | */ |
| 46 | |
| 47 | /* |
| 48 | Include declarations. |
| 49 | */ |
| 50 | #include <stdio.h> |
| 51 | #include <stdlib.h> |
| 52 | #include <string.h> |
| 53 | #include <time.h> |
| 54 | #include "wand/MagickWand.h" |
| 55 | #if defined(__WINDOWS__) |
| 56 | #include <windows.h> |
| 57 | #endif |
| 58 | |
| 59 | /* |
| 60 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 61 | % % |
| 62 | % % |
| 63 | % % |
| 64 | % M a i n % |
| 65 | % % |
| 66 | % % |
| 67 | % % |
| 68 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 69 | % |
| 70 | % |
| 71 | */ |
| 72 | int main(int argc,char **argv) |
| 73 | { |
| 74 | char |
| 75 | *option; |
| 76 | |
| 77 | ExceptionInfo |
| 78 | *exception; |
| 79 | |
| 80 | ImageInfo |
| 81 | *image_info; |
| 82 | |
| 83 | MagickBooleanType |
| 84 | regard_warnings, |
| 85 | status; |
| 86 | |
| 87 | register long |
| 88 | i; |
| 89 | |
| 90 | MagickCoreGenesis(*argv,MagickTrue); |
| 91 | exception=AcquireExceptionInfo(); |
| 92 | regard_warnings=MagickFalse; |
| 93 | for (i=1; i < (long) argc; i++) |
| 94 | { |
| 95 | option=argv[i]; |
| 96 | if ((strlen(option) == 1) || ((*option != '-') && (*option != '+'))) |
| 97 | continue; |
| 98 | if (LocaleCompare("debug",option+1) == 0) |
| 99 | (void) SetLogEventMask(argv[++i]); |
| 100 | if (LocaleCompare("regard-warnings",option+1) == 0) |
| 101 | regard_warnings=MagickTrue; |
| 102 | } |
| 103 | image_info=AcquireImageInfo(); |
| 104 | status=ConvertImageCommand(image_info,argc,argv,(char **) NULL,exception); |
| 105 | if ((status == MagickFalse) || (exception->severity != UndefinedException)) |
| 106 | { |
| 107 | if ((exception->severity < ErrorException) && |
| 108 | (regard_warnings == MagickFalse)) |
| 109 | status=MagickTrue; |
| 110 | CatchException(exception); |
| 111 | } |
| 112 | image_info=DestroyImageInfo(image_info); |
| 113 | exception=DestroyExceptionInfo(exception); |
| 114 | MagickCoreTerminus(); |
| 115 | return(status == MagickFalse ? 1 : 0); |
| 116 | } |
Note: See TracBrowser
for help on using the browser.
