BMPtoTxt
提示:这里可以添加技术概要
核心源码
procedure BitmapToRGBValues(const BMPFilename: string;
const DataFilename: string);
var
Bitmap: TBitmap;
DataFile: TextFile;
i: INTEGER;
j: INTEGER;
row: pRGBTripleArray;
begin
Bitmap := TBitmap.Create;
try
Bitmap.LoadFromFile(BMPFilename);
Bitmap.PixelFormat := pf24bit;
// 24bit位图
Assignfile(DataFile, DataFilename);
REWRITE(DataFile);
//打开文本文件
WRITELN(DataFile, FileSignature);
//写入文件签名
WRITELN(DataFile, Bitmap.Width, ' ', Bitmap.Height);
//文件大小
for j := 0 to Bitmap.Height - 1 do
begin
row := Bitmap.Scanline[j];
WRITE(DataFile, 'R ');
for i := 0 to Bitmap.