| Last change
 on this file since 3824 was             3553, checked in by ansari, 17 years ago | 
        
          | 
Creation du module PIPhoto, interface piapp-ImageMagick pour la manipulation des images (jpg, gif...) ds piapp - Reza 14 Dec 2008
 | 
        
          | File size:
            1.3 KB | 
      
      
| Line |  | 
|---|
| 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: 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.