http://www.imagemagick.org/Magick++/Image.html#Constructors にあるコンストラクタ とメソッドのドキュメントを見ましたが、これぐらいは書かないとだめなようです。 拡張子:txtvbswsfjsphpjavahtmlutf8sjis // ********************************************************* // 一括処理はやはり一覧が必要 // ********************************************************* #include <windows.h> #include <Magick++.h> #include <string> #include <iostream> using namespace std; using namespace Magick; int main( int argc, char argv[] ) { HANDLE hFile; BOOL bRet; WIN32_FIND_DATA wfd; Image image; string work; hFile = FindFirstFile( "..\\png\\*.png", &wfd ); bRet = true; while( hFile != INVALID_HANDLE_VALUE && bRet == (BOOL)true ) { try { work = "..\\png\\"; work += wfd.cFileName; image.read( work ); image.crop( Geometry( 380, 540, 50, 50 ) ); image.write( wfd.cFileName ); } catch( Exception &error_ ) { printf( "エラーが発生しました : %s : ", error_.what() ); } bRet = FindNextFile( hFile, &wfd ); } if ( !bRet ) { FindClose( hFile ); } return 1; }
// ********************************************************* // 一括処理はやはり一覧が必要 // ********************************************************* #include <windows.h> #include <Magick++.h> #include <string> #include <iostream> using namespace std; using namespace Magick; int main( int argc, char argv[] ) { HANDLE hFile; BOOL bRet; WIN32_FIND_DATA wfd; Image image; string work; hFile = FindFirstFile( "..\\png\\*.png", &wfd ); bRet = true; while( hFile != INVALID_HANDLE_VALUE && bRet == (BOOL)true ) { try { work = "..\\png\\"; work += wfd.cFileName; image.read( work ); image.crop( Geometry( 380, 540, 50, 50 ) ); image.write( wfd.cFileName ); } catch( Exception &error_ ) { printf( "エラーが発生しました : %s : ", error_.what() ); } bRet = FindNextFile( hFile, &wfd ); } if ( !bRet ) { FindClose( hFile ); } return 1; }