cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 % |
cristy | de984cd | 2013-12-01 14:49:27 +0000 | [diff] [blame] | 16 | % Cristy % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 17 | % April 1992 % |
| 18 | % % |
| 19 | % % |
cristy | fe676ee | 2013-11-18 13:03:38 +0000 | [diff] [blame] | 20 | % Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization % |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 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 | */ |
cristy | ee67810 | 2011-07-01 23:32:11 +0000 | [diff] [blame] | 50 | #include "MagickWand/studio.h" |
| 51 | #include "MagickWand/MagickWand.h" |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 52 | |
| 53 | /* |
| 54 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 55 | % % |
| 56 | % % |
| 57 | % % |
| 58 | % M a i n % |
| 59 | % % |
| 60 | % % |
| 61 | % % |
| 62 | %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% |
| 63 | % |
| 64 | % |
| 65 | */ |
cristy | 66f9c3c | 2011-08-13 17:12:28 +0000 | [diff] [blame] | 66 | |
cristy | 9c88feb | 2011-09-21 13:06:09 +0000 | [diff] [blame] | 67 | static int ConvertMain(int argc,char **argv) |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 68 | { |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 69 | ExceptionInfo |
| 70 | *exception; |
| 71 | |
| 72 | ImageInfo |
| 73 | *image_info; |
| 74 | |
| 75 | MagickBooleanType |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 76 | status; |
| 77 | |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 78 | MagickCoreGenesis(*argv,MagickTrue); |
| 79 | exception=AcquireExceptionInfo(); |
cristy | 3980b0d | 2009-10-25 14:37:13 +0000 | [diff] [blame] | 80 | image_info=AcquireImageInfo(); |
cristy | 3980b0d | 2009-10-25 14:37:13 +0000 | [diff] [blame] | 81 | status=MagickCommandGenesis(image_info,ConvertImageCommand,argc,argv, |
cristy | 4e1dff6 | 2009-10-25 20:36:03 +0000 | [diff] [blame] | 82 | (char **) NULL,exception); |
cristy | 3980b0d | 2009-10-25 14:37:13 +0000 | [diff] [blame] | 83 | image_info=DestroyImageInfo(image_info); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 84 | exception=DestroyExceptionInfo(exception); |
| 85 | MagickCoreTerminus(); |
cristy | ebd71f4 | 2013-09-13 22:35:48 +0000 | [diff] [blame] | 86 | return(status == MagickFalse ? 0 : 1); |
cristy | 3ed852e | 2009-09-05 21:47:34 +0000 | [diff] [blame] | 87 | } |
cristy | 66f9c3c | 2011-08-13 17:12:28 +0000 | [diff] [blame] | 88 | |
cristy | 07a3cca | 2012-12-10 13:09:10 +0000 | [diff] [blame] | 89 | #if !defined(MAGICKCORE_WINDOWS_SUPPORT) || defined(__CYGWIN__) || defined(__MINGW32__) || defined(__MINGW64__) |
cristy | 66f9c3c | 2011-08-13 17:12:28 +0000 | [diff] [blame] | 90 | int main(int argc,char **argv) |
| 91 | { |
cristy | 17b13ce | 2014-05-18 13:27:26 +0000 | [diff] [blame] | 92 | register int |
| 93 | i; |
| 94 | |
| 95 | for (i=0; i < argc; i++) |
| 96 | if (argv[i] == (char *) NULL) |
| 97 | break; |
| 98 | if (i < argc) |
| 99 | return(-1); |
cristy | 66f9c3c | 2011-08-13 17:12:28 +0000 | [diff] [blame] | 100 | return(ConvertMain(argc,argv)); |
| 101 | } |
| 102 | #else |
| 103 | int wmain(int argc,wchar_t *argv[]) |
| 104 | { |
| 105 | char |
| 106 | **utf8; |
| 107 | |
| 108 | int |
| 109 | status; |
| 110 | |
| 111 | register int |
| 112 | i; |
| 113 | |
| 114 | utf8=NTArgvToUTF8(argc,argv); |
| 115 | status=ConvertMain(argc,utf8); |
| 116 | for (i=0; i < argc; i++) |
| 117 | utf8[i]=DestroyString(utf8[i]); |
| 118 | utf8=(char **) RelinquishMagickMemory(utf8); |
cristy | ebd71f4 | 2013-09-13 22:35:48 +0000 | [diff] [blame] | 119 | return(status == MagickFalse ? 0 : 1); |
cristy | 66f9c3c | 2011-08-13 17:12:28 +0000 | [diff] [blame] | 120 | } |
| 121 | #endif |