Board index » delphi » Invalid graphic

Invalid graphic


2007-02-09 08:52:33 AM
delphi63
I use the following code to save a bitmap
if SavePictureDialog1.Execute then
img.Picture.SaveToFile(SavePictureDialog1.FileName);
When I load the file into my app using the following codeI get an error
message "bitmap image is not valid"
img.Picture.LoadFromFile(FileName);
The file open properly with Paint. Any help here would be appreciated.
 
 

Re:Invalid graphic

"George Kuascha" <XXXX@XXXXX.COM>writes
Quote
I use the following code to save a bitmap
if SavePictureDialog1.Execute then
img.Picture.SaveToFile(SavePictureDialog1.FileName);
When I load the file into my app using the following codeI get an error
message "bitmap image is not valid"
img.Picture.LoadFromFile(FileName);

The file open properly with Paint. Any help here would be appreciated.
try setting the bitmap's pixelformat to pf24bit or pf32bit before saving the
file. If you are in 16bit color mode in your display, delphi may create a
16bit color bitmap which a lot of apps cant read.