这是reboot网友的法子,不知道可行否:
BMP文件头偏移26H和2AH开始的每四个字节(DWORD)
对应水平分辨率和垂直分辨率(每米Pixels个数)。
通常取值为0B12(72dpi)和0EC3(96dpi)
var
FormImage: TBitmap;
Info: PBitmapInfo;
InfoSize: DWORD;
Image: Pointer;
ImageSize: DWORD;
Bits: HBITMAP;
DIBWidth, DIBHeight: Longint;
px,py:integer;
Size: TPoint;
begin
FormImage := Tbitmap.Create;
formimage.loadfromfile('xxxxxxxx');
try
Bits := FormImage.Handle;
GetDIBSizes(Bits, InfoSize, ImageSize);
Info := AllocMem(InfoSize);
Image := AllocMem(ImageSize);
GetDIB(Bits, 0, Info^, Image^);
with Info^.bmiHeader do
begin
DIBWidth := biWidth;
DIBHeight := biHeight;
px:=biXPelsPerMeter; //每米的象素
py:=biXPelsPerMeter; //每米的象素
end;
finally;
formImage.free;