source: Sophya/trunk/AddOn/PIPhoto/rgb2img.cc@ 3907

Last change on this file since 3907 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
RevLine 
[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
14using namespace std;
15using namespace Magick;
16
17int main(int argc,char **argv)
18{
19 if (argc < 3) {
20 cout << " Usage: rgb2img InputImageFile OutputFile \n"
21 << " Input: PI-RB (.rgb) Output: jpeg/gif/... " << 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 an PIPixRGBArray
35 PIPixRGBArray rgba(argv[1]);
36 cout << "Converting to Magick::Image - Width= " << rgba.XSize()
37 << " Height= " << rgba.YSize() << endl;
38 ImgMagObj image(rgba);
39 string outfile = argv[2];
40 cout << " ---- writing Magick::Image to file " << outfile << endl;
41 image.write(outfile);
42 }
43 catch( Exception &error_ )
44 {
45 cout << "Caught Exception: " << error_.what() << endl;
46 return 1;
47 }
48 catch( std::exception &error_ )
49 {
50 cout << "Caught exception: " << error_.what() << endl;
51 return 1;
52 }
53 return 0;
54}
Note: See TracBrowser for help on using the repository browser.