Delphi Programming Forum
C++Builder  |  Delphi  |  FireMonkey  |  C/C++  |  Free Pascal  |  Firebird
볼랜드포럼 BorlandForum
 경고! 게시물 작성자의 사전 허락없는 메일주소 추출행위 절대 금지
델파이 포럼
Q & A
FAQ
팁&트릭
강좌/문서
자료실
컴포넌트/라이브러리
FreePascal/Lazarus
볼랜드포럼 홈
헤드라인 뉴스
IT 뉴스
공지사항
자유게시판
해피 브레이크
공동 프로젝트
구인/구직
회원 장터
건의사항
운영진 게시판
회원 메뉴
북마크
델마당
볼랜드포럼 광고 모집

델파이 Q&A
Delphi Programming Q&A
[3618] [정보] 24비트 칼라에서 8비트로 전환하는 법
grcsb [ ] 1463 읽음    1998-07-11 05:09
아래를 참고하세요..
PixelFormat프로퍼티를 참고하세요..


From 류..

---------

Frequently Asked Questions
Displaying a 24 bit True Color bitmap image on a 256 color display
Question:
How can I display a 24 bit True Color bitmap image on a 256 color Display under Delphi 3?
Answer:
You can take advantage of the new graphics capabilities of the
TBimap and TJpegImage components of Delphi 3. When Delphi 3 loads a
bitmap image, it keeps a copy of the device independent bitmap image
it loads from a file in the background. The TJPEGImage component is
very good at color reducing a full color image down to 256 colors.
By Loading the bitmap, then assigning the image to a Jpeg and saving
it to a temporary ".JPG" file, you can then load the temporary file
back into a TImage with much better results than simply loading the
bitmap file unconverted. The following example demonstrates the
necessary steps to achieve these results.

Example:

uses JPEG;

procedure TForm1.Button1Click(Sender: TObject);
var
  JP : TJPEGImage;
  IM : TImage;
  TempFileName : string;
begin
{Pop up a Open Dialog}
  OpenDialog1.Options := [ofNoChangeDir, ofFileMustExist];
  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;
end;


Ba


+ -

관련 글 리스트
3618 [정보] 24비트 칼라에서 8비트로 전환하는 법 grcsb 1463 1998/07/11
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.