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

C++빌더 Q&A
C++Builder Programming Q&A
[43348] Re:이미지 크기를 줄여 새로 저장한 파일의 화질이 형편없습니다. 어떻게?
elliclaura [kiss2u] 1204 읽음    2006-01-17 19:22
강요찬(난나) 님이 쓰신 글 :
: 안녕하세요...
:
: 그래픽 처리를 할 필요가 있어 여기저기 도움을 얻어 간단하게 작성을 해봤습니다만...
: Al-See 에서 이미지크기를 줄이면 화질의 변화를 전혀 느끼지 못하겠는데,
: 아래 소스로 변환하면 화질이 엉망이 되어 버리는군요... 어떤 다른 그래픽처리를 해줘야 하는 것 같습니다...
: 어떤 작업을 해줘야 하는지요?
:
: 혹, 관련 컴포넌트라도 알고 계시다면 답글 부탁드립니다...
:
: 감사합니다... (--)(__)
:
:
: Graphics::TBitmap *bmpptr;
: Graphics::TBitmap *new_bmp;
: TJPEGImage *jpg_temp;
:
: void __fastcall TFPicManager::EditSize(AnsiString fname)
: {
:   AnsiString atemp=ExtractFileExt(fname).LowerCase();
:   if (atemp==".bmp") {
:     bmpptr->LoadFromFile(fname);
:   } else { // jpg 경우
:     jpg_temp->LoadFromFile(fname);
:     bmpptr->Assign(jpg_temp);
:   }
:
:   //---------------------------------------------------------------------------
:   //사이즈 변경.
:   //---------------------------------------------------------------------------
:   //Graphics::TBitmap*new_bmp=new Graphics::TBitmap();
:   // new bmp 크기 조정
:   new_bmp->Assign(bmpptr);
:   new_bmp->Width=_ww;
:   new_bmp->Height=_hh;
:
:     new_bmp->Canvas->Handle,    // handle of destination device context
:     0,    // x-coordinate of upper-left corner of dest. rect.
:     0,    // y-coordinate of upper-left corner of dest. rect.
:     new_bmp->Width,    // width of destination rectangle
:     new_bmp->Height,    // height of destination rectangle
:     bmpptr->Canvas->Handle,    // handle of source device context
:     0,    // x-coordinate of upper-left corner of source rectangle
:     0,    // y-coordinate of upper-left corner of source rectangle
:     bmpptr->Width,    // width of source rectangle
:     bmpptr->Height,    // height of source rectangle
:     SRCCOPY     // raster operation code
:   );
:
:   AnsiString new_fname=ExtractFilePath(fname)+_pre+ExtractFileName(fname);
:   jpg_temp->Assign(new_bmp);
:   jpg_temp->SaveToFile(new_fname);
: }
: //---------------------------------------------------------------------------



StretchBlt를 하시기 바로전에

     SetStretchBltMode(new_bmp->Picture->Bitmap->Canvas->Handle, HALFTONE);
   
이걸 추가해 주시고요. 물론 윈95등에서는 작동하지 않습니다.

그래도 화질이 맘에 들지 않으신다면,
bmpptr->LoadFromFile(fname); 하시기전에 이 그림이 24bit다 32bit다 알려주기위해

new_bmp->Picture->Bitmap->PixelFormat = pf24bit;
를 추가해 보세요 ^^

+ -

관련 글 리스트
43345 이미지 크기를 줄여 새로 저장한 파일의 화질이 형편없습니다. 어떻게? 강요찬(난나) 1012 2006/01/17
43348     Re:이미지 크기를 줄여 새로 저장한 파일의 화질이 형편없습니다. 어떻게? elliclaura 1204 2006/01/17
43349         Re:Re:이미지 크기를 줄여 새로 저장한 파일의 화질이 형편없습니다. 어떻게? 강요찬(난나) 1301 2006/01/17
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.