Normally is writing as a bitmap the best solution, because other programs can easily work with that data.
You can also write every COLORREF in a file. A COLORREF is a DWORD with 4 byte size.
CFile cfile;
cfile.Open(_T("picture.dat"), CFile::modeCreate | CFile::modeReadWrite);
cfile.Write(&colorref, sizeof(COLORREF));
cfile.Flush();