可能对你有点帮助,这是显示如何在一台256色的机器上显示真彩色的程序和说明:You can take advantage of the new graphics capabilities of theTBimap and TJpegImage components of Delphi 3. When Delphi 3 loads abitmap imageit keeps a copy of the device independent bitmap imageit loads from a file in the background. The TJPEGImage component isvery good at color reducing a full color image down to 256 colors.By Loading the bitmapthen assigning the image to a Jpeg and savingit to a temporary ".JPG" fileyou can then load the temporary fileback into a TImage with much better results than simply loading thebitmap file unconverted. The following example demonstrates thenecessary steps to achieve these results.
Example:
uses JPEG;
procedure TForm1.Button1Click(Sender: TObject);varJP : TJPEGImage;IM : TImage;TempFileName : string;begin{Pop up a Open Dialog}OpenDialog1.Options := [ofNoChangeDirofFileMustExist];OpenDialog1.Filter := 'Bitmap Files (*.bmp)|*.bmp';if OpenDialog1.Execute then begin{Create a temporary TImage}IM := TImage.Create(nil);{Load the bitmap file}IM.Picture.LoadFromFile(OpenDialog1.FileName);{Create a temporary TJPEGImage}JP := TJPEGImage.Create;{Priorty on quality}JP.Performance := jpBestQuality;{Assign the bitmap to the JPEG}JP.Assign(IM.Picture.Graphic);{Free the temp image}IM.Free;{Make a temp file name with the extension of .jpg}TempFileName := 'test.jpg';{Save the JPEG to a temp file}JP.SaveToFile(TempFileName);{Free the JPEG}JP.Free;{Load the temp file to an image on the form}Image1.Picture.LoadFromFile(TempFileName);{Delete the temp file}DeleteFile(TempFileName);end;