出典:https://bbs.csdn.net/topics/391956973 3階
書式#include <iostreamの> の#include <fstreamの> の#include < 文字列 > の#include <windows.hに> する#include <gdiplus.h> の#pragmaコメント(libに、 "gdiplus.lib")使用して名前空間はstdを、 使用して名前空間をのGdiPlus。INT メイン(){ GdiplusStartupInput gdiplusstartupinput。 ULONG_PTRのgdiplustoken。 GdiplusStartup(&gdiplustoken、&gdiplusstartupinput、NULL); wstringのinFileNameは(L " 1.JPG " )。 文字列 outFileNameは(" 色。 " ); ビットマップ * BMP = 新しいビットマップ(infilename.c_str()); UINT高さ = BMP-> のgetHeight(); UINT幅 = BMP-> のgetWidth(); COUT << " 幅" <<幅<< " 、高さ「 <<高<< ENDL、 カラー色、 ofstreamのFOUT(outfilename.c_str()); のための(UINTのY = 0、Y ++; Y <高さ) のために(UINT X = 0 ; X <幅; X ++ ){ BMP - > getPixelメソッド(X、Y、&色); FOUT << X << " " << Y << " " <<(INT)color.GetRed()<< " " <<(INT)color.GetGreen()<< " " <<(int型)color.GetBlue()<< てendl; } fout.close()。削除BMPを。 GdiplusShutdown(gdiplustoken)。リターン0 ; }