怎么用C++提取图片的像素坐标和RGB值,跪求大神!

如何用C++提取图片的像素坐标和RGB值,跪求大神!!!
想把一张图片的每个像素的坐标以及RGB值提取出来,有没有大神愿意抽点时间帮我搞下啊?实在是不会。
是每一个像素,最好存到文本文件中吧。格式是:a,b,c,d,e;其中a和b代表像素X和Y坐标,其余分别代表R,G,B值。每组用分号隔开。
谢谢了!!真的是急用啊!!!

------解决方案--------------------
引用:
Quote: 引用:

gdi+的Bitmap对象就可以做到了,能读取多种文件格式。
#include <iostream>
#include <fstream>
#include <string>
#include <windows.h>
#include <gdiplus.h>
#pragma comment(lib, "gdiplus.lib")

using namespace std;
using namespace Gdiplus;


int main()
{
GdiplusStartupInput gdiplusstartupinput;
ULONG_PTR gdiplustoken;
GdiplusStartup(&gdiplustoken, &gdiplusstartupinput, nullptr);

wstring infilename(L"1.jpg");
string outfilename("color.txt");
//读图片
Bitmap* bmp = new Bitmap(infilename.c_str());
UINT height = bmp->GetHeight();
UINT width = bmp->GetWidth();
cout << "width " << width << ", height " << height << endl;

Color color;
ofstream fout(outfilename.c_str());

for (int y = 0; y < height; y++)
for (int x = 0; x < width; x++)
{
bmp->GetPixel(x, y, &color);
fout << x << ";" << y << ";"
 << (int)color.GetRed() << ";"
 << (int)color.GetGreen() << ";"
 << (int)color.GetBlue() << endl;
}

fout.close();

delete bmp;
GdiplusShutdown(gdiplustoken);
return 0;
}


大神!!帮我搞一下行吗?我现在真的十万火急啊。。百度谷歌都没办法。。


不是按照你的要求做好了吗?
读取1个jpg图片,生成1个txt文件,每行是x,y,r,g,b