Advertisement
Guest User

Untitled

a guest
Dec 6th, 2010
228
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.93 KB | None | 0 0
  1. #define _CRT_SECURE_NO_WARNINGS 1
  2. #define _SCL_SECURE_NO_WARNINGS 1
  3.  
  4. #include <stdio.h>
  5. #include <tchar.h>
  6.  
  7. #include <fstream>
  8. #include <sstream>
  9.  
  10. #include <cassert>
  11. #include <boost/gil/gil_all.hpp>
  12. #include <boost/gil/extension/io_new/jpeg_all.hpp>
  13.  
  14. using namespace std;
  15. using namespace boost;
  16. using namespace gil;
  17.  
  18. template< typename Image >
  19. void read_mem_jpeg( Image& dest
  20.                   , const char* jpeg_file
  21.                   , const char* jpeg_file_end
  22.                   )
  23. {
  24.     istringstream ss( string( jpeg_file, jpeg_file_end ), std::ios::binary );
  25.  
  26.     read_image( ss, dest, jpeg_tag() );
  27. }
  28.  
  29. int main()
  30. {
  31.     char jpeg_file[4096];
  32.  
  33.     char filename[] = "C:/chh/gil_contributions/test_images/jpg/found online/test.jpg";
  34.  
  35.     ifstream in( filename, std::ios::binary );
  36.     in.read( jpeg_file, 4096 );
  37.  
  38.     rgb8_image_t img;
  39.     read_mem_jpeg( img, jpeg_file, jpeg_file + 4096 );
  40.  
  41.     return 0;
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement