Last change
on this file since 3982 was 3554, checked in by ansari, 17 years ago |
This commit was generated by cvs2svn to compensate for changes in r3553,
which included commits to RCS files with non-trunk default branches.
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3553] | 1 | #include "machdefs.h"
|
---|
| 2 | #include "sopnamsp.h"
|
---|
| 3 |
|
---|
| 4 | #include <iostream>
|
---|
| 5 | #include <sstream>
|
---|
| 6 | #include <string>
|
---|
| 7 |
|
---|
| 8 | #include "array.h"
|
---|
| 9 | #include "tarrinit.h"
|
---|
| 10 |
|
---|
| 11 | #include "imgmag_pi.h"
|
---|
| 12 |
|
---|
| 13 |
|
---|
| 14 | using namespace std;
|
---|
| 15 | using namespace Magick;
|
---|
| 16 |
|
---|
| 17 | int main(int argc,char **argv)
|
---|
| 18 | {
|
---|
| 19 | if (argc < 3) {
|
---|
| 20 | cout << " Usage: img2rgb InputImageFile OutputFile \n"
|
---|
| 21 | << " Input: jpeg/gif/... OutFile: PI-RB (.rgb) " << endl;
|
---|
| 22 | return 0;
|
---|
| 23 | }
|
---|
| 24 | /*
|
---|
| 25 | cout << " Initializing image magick ... " << endl;
|
---|
| 26 | InitializeMagick(argv[0]);
|
---|
| 27 | */
|
---|
| 28 | cout << " Initializing SOPHYA ... " << endl;
|
---|
| 29 | SophyaInit();
|
---|
| 30 |
|
---|
| 31 | try {
|
---|
| 32 | string infile = argv[1];
|
---|
| 33 | cout << " Reading input file " << infile << endl;
|
---|
| 34 | // Read a file into image object
|
---|
| 35 | ImgMagObj image(infile);
|
---|
| 36 | cout << "Converting to PIPixRGBArray - Width= " << image.columns()
|
---|
| 37 | << " Height " << image.rows() << endl;
|
---|
| 38 | PIPixRGBArray rgba(0,0);
|
---|
| 39 | image.FillPIRGBArray(rgba);
|
---|
| 40 | string outfile = argv[2];
|
---|
| 41 | cout << " ---- writing rgbimg to file " << outfile << endl;
|
---|
| 42 | rgba.SaveToFile(outfile.c_str());
|
---|
| 43 | }
|
---|
| 44 | catch( Exception &error_ )
|
---|
| 45 | {
|
---|
| 46 | cout << "Caught Exception: " << error_.what() << endl;
|
---|
| 47 | return 1;
|
---|
| 48 | }
|
---|
| 49 | catch( std::exception &error_ )
|
---|
| 50 | {
|
---|
| 51 | cout << "Caught exception: " << error_.what() << endl;
|
---|
| 52 | return 1;
|
---|
| 53 | }
|
---|
| 54 | return 0;
|
---|
| 55 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.