| 
            Last change
 on this file since 3649 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.6 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 | // Conversion d'une serie de fichiers RGB en GIF anime
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | int main(int argc,char **argv) 
 | 
|---|
 | 20 | { 
 | 
|---|
 | 21 |   if (argc < 4) {
 | 
|---|
 | 22 |     cout << "  Usage: animrgbs OutputFile InFile1 InFile2 InFile3 ...\n" 
 | 
|---|
 | 23 |          << "    Output: .gif  - InputFiles: PI-RB (.rgb) " << endl;
 | 
|---|
 | 24 |     return 0;
 | 
|---|
 | 25 |   }
 | 
|---|
 | 26 | /*
 | 
|---|
 | 27 |   cout << " Initializing image magick ... " << endl;
 | 
|---|
 | 28 |   InitializeMagick(argv[0]);
 | 
|---|
 | 29 | */
 | 
|---|
 | 30 |   cout << " Initializing SOPHYA  ... " << endl;
 | 
|---|
 | 31 |   SophyaInit();
 | 
|---|
 | 32 | 
 | 
|---|
 | 33 |   try { 
 | 
|---|
 | 34 |     list<Image> imageList; 
 | 
|---|
 | 35 |     for(int k=2; k<argc; k++) { 
 | 
|---|
 | 36 |       // Read a file into an PIPixRGBArray
 | 
|---|
 | 37 |       cout << k-1 << "- Reading RGB file " << argv[k] << endl;
 | 
|---|
 | 38 |       PIPixRGBArray rgba(argv[k]);
 | 
|---|
 | 39 |       cout << "Converting to Magick::Image -  Width= " << rgba.XSize() 
 | 
|---|
 | 40 |          << " Height= " << rgba.YSize() << endl;
 | 
|---|
 | 41 |       ImgMagObj image(rgba);
 | 
|---|
 | 42 |       image.adjoin(true);
 | 
|---|
 | 43 |       image.animationDelay(10);  // en unite de 1/100 second -> 1/10 sec
 | 
|---|
 | 44 |       image.animationIterations(5);
 | 
|---|
 | 45 |       imageList.push_back(image);
 | 
|---|
 | 46 |       /*
 | 
|---|
 | 47 |       Image appended; 
 | 
|---|
 | 48 |       appendImages( &appended, imageList.begin(), imageList.end() ); 
 | 
|---|
 | 49 |       appended.write( "appended_image.miff" ); 
 | 
|---|
 | 50 |       */
 | 
|---|
 | 51 |     }
 | 
|---|
 | 52 |     string outfile = argv[1];
 | 
|---|
 | 53 |     cout << " ---- writing image sequence to file " << outfile << endl;
 | 
|---|
 | 54 |     writeImages(imageList.begin(), imageList.end(), outfile, true); 
 | 
|---|
 | 55 |   } 
 | 
|---|
 | 56 |   catch( Exception &error_ ) { 
 | 
|---|
 | 57 |     cout << "animrgbs: Caught Exception: " << error_.what() << endl; 
 | 
|---|
 | 58 |     return 1; 
 | 
|---|
 | 59 |   } 
 | 
|---|
 | 60 |   return 0; 
 | 
|---|
 | 61 | }
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.