20 static void Usage (
char **argv )
22 cout <<
"Usage: " << argv[0]
23 <<
" [-density resolution] [-filter algorithm] [-geometry geometry]" 24 <<
" [-resample resolution] input_file output_file" << endl
25 <<
" algorithm - bessel blackman box catrom cubic gaussian hamming hanning" << endl
26 <<
" hermite lanczos mitchell point quadratic sample scale sinc triangle" << endl;
32 cout <<
"Argument \"" << argv[position] <<
"\" at position" << position
33 <<
"incorrect" << endl;
37 int main(
int argc,
char **argv)
54 Magick::FilterType filter(LanczosFilter);
57 ResizeAlgorithm resize_algorithm=Zoom;
60 while ((argv_index < argc - 2) && (*argv[argv_index] ==
'-'))
62 std::string command(argv[argv_index]);
63 if (command.compare(
"-density") == 0)
76 else if (command.compare(
"-filter") == 0)
79 std::string algorithm(argv[argv_index]);
80 if (algorithm.compare(
"point") == 0)
82 else if (algorithm.compare(
"box") == 0)
84 else if (algorithm.compare(
"triangle") == 0)
85 filter=TriangleFilter;
86 else if (algorithm.compare(
"hermite") == 0)
88 else if (algorithm.compare(
"hanning") == 0)
90 else if (algorithm.compare(
"hamming") == 0)
92 else if (algorithm.compare(
"blackman") == 0)
93 filter=BlackmanFilter;
94 else if (algorithm.compare(
"gaussian") == 0)
95 filter=GaussianFilter;
96 else if (algorithm.compare(
"quadratic") == 0)
97 filter=QuadraticFilter;
98 else if (algorithm.compare(
"cubic") == 0)
100 else if (algorithm.compare(
"catrom") == 0)
102 else if (algorithm.compare(
"mitchell") == 0)
103 filter=MitchellFilter;
104 else if (algorithm.compare(
"lanczos") == 0)
105 filter=LanczosFilter;
106 else if (algorithm.compare(
"bessel") == 0)
108 else if (algorithm.compare(
"sinc") == 0)
110 else if (algorithm.compare(
"sample") == 0)
111 resize_algorithm=Sample;
112 else if (algorithm.compare(
"scale") == 0)
113 resize_algorithm=Scale;
119 else if (command.compare(
"-geometry") == 0)
123 geometry=
Geometry(argv[argv_index]);
132 else if (command.compare(
"-resample") == 0)
136 resample=
Geometry(argv[argv_index]);
148 if (argv_index>argc-1)
150 std::string input_file(argv[argv_index]);
154 std::string output_file(argv[argv_index]);
157 Image image(input_file);
166 (image.
columns()*((double)resample.
x()/density.
x())+0.5),
168 (image.
rows()*((double)resample.
y()/density.
y())+0.5));
171 switch (resize_algorithm)
177 image.
scale(geometry);
181 image.
zoom(geometry);
184 image.
write(output_file);
186 catch( exception &error_ )
188 cout <<
"Caught exception: " << error_.what() << endl;
void density(const Point &density_)
void zoom(const Geometry &geometry_)
void filterType(const FilterType filterType_)
static void ParseError(int position, char **argv)
class MagickPPExport Geometry
void scale(const Geometry &geometry_)
void sample(const Geometry &geometry_)
size_t columns(void) const
static void Usage(char **argv)
int main(int argc, char **argv)
MagickPPExport void InitializeMagick(const char *path_)