Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2026-04-09 07:49:18

0001 /**
0002 SIMGTest.cc : Loads PNG/JPG image from provided path and saves it in PNG and JPG with variety of quality settings 
0003 =====================================================================================================================
0004 
0005 The standardly build executable can be run with::
0006 
0007     SIMGTest /tmp/flower.jpg
0008 
0009 For non-CMake build and run use::
0010 
0011     IMGPATH=/tmp/flower.jpg ~/o/sysrap/tests/SIMGTest.sh 
0012     IMGPATH=$HOME/rocket.jpg ~/o/sysrap/tests/SIMGTest.sh 
0013 
0014 **/
0015 
0016 #include <sstream>
0017 #include <iostream>
0018 #define SIMG_IMPLEMENTATION 1 
0019 #include "SIMG.h"
0020 
0021 #include "s_time.h"
0022 
0023 int main(int argc, char** argv)
0024 {
0025     const char* path = argc > 1 ? argv[1] : nullptr ; 
0026     if(path == nullptr) 
0027     {
0028         std::cout << argv[0] << " : a single argument with the path to an image file is required " << std::endl ; 
0029         return 0 ; 
0030     }    
0031 
0032     SIMG img(path); 
0033     std::cout << img.desc() << std::endl ; 
0034 
0035     std::stringstream ss ;
0036     ss << "SIMGTest " << s_time::Format() ; 
0037     std::string s = ss.str(); 
0038 
0039     img.annotate(s.c_str()); 
0040 
0041     img.writePNG(); 
0042     img.writeJPG(100); 
0043     img.writeJPG(50); 
0044     img.writeJPG(10); 
0045     img.writeJPG(5); 
0046 
0047     img.writeNPY(); 
0048   
0049     return 0 ; 
0050 }
0051