Re:strange thing with bmp
Sounds like there's a bug with the offending bitmap: I've encountered a
similar thing where there was an extra entry in the colour table (257
colour bitmap ?!!), and the VCL code expected the start of the pixel data
to be in the "right place" - explaining the right shift, and the colour
problems. The bitmap header format does specify an offset to the pixel
data, which the VCL doesn't use - and hence when you re-save the bitmap
changes size.
If the re-loaded bitmap after saving looks the same, this could be it, as
the VCL save bitmaps correctly.
You can fix the bitmap loading code by overriding the LoadFromStream ina
descendant class of TBitmap, and using that to LoadFormFile.
HTH
Patrick
Quote
khomalex wrote:
> Hello Everybody,
> Simple code :
> // -----
> procedure TForm1.Button1Click(Sender: TObject);
> var bmp: TBitmap;
> begin
> bmp := TBitmap.Create;
> bmp.LoadFromFile(ExtractFilePath(Application.ExeName)+'bmp1.bmp');
> bmp.SaveToFile(ExtractFilePath(Application.ExeName)+'bmp2.bmp');
> bmp.Free;
> end;
> // -----
> But surprisingly I get a file size 921654 instead of 921658 bytes,
> blue instead of red, red instead of green and some right shift of the
> picture. The original bmp was created with TFastBMP component if
> somebody knows it. It really damned. Please help if somebody knows
> what the problem is...
> Regards, Thanx in advance, Alex.