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
[68267] Re:Re:컬러 영상(24Bit) 이미지를 Gray 8bit로 변경 방법
광땡 [] 2011 읽음    2012-09-27 11:24
답변 감사합니다. ^^
이렇게 해보니 8bit로 저장이 되네요.
하나 더 궁금한게 있는데 이걸 다시 jpg File로 저장하니 24bit로 바뀌던데
혹시 jpg File을 8bit로 저장은 못하나요??



방태윤 님이 쓰신 글 :
: TBitmap*bmp=new TBitmap();
:     bmp->LoadFromFile("c:\\24bit.bmp");
:
:     TBitmap*bmp256=new TBitmap();
:     bmp256->PixelFormat=pf8bit;
:     bmp256->Width=bmp->Width;
:     bmp256->Height=bmp->Height;
:
:     struct s_pal{
:         LOGPALETTE pal;
:         PALETTEENTRY dummy[256];
:     };
:     s_pal new_pal;
:
:     new_pal.pal.palVersion=0x300;
:     new_pal.pal.palNumEntries=256;
:     for(int i=0;i<256;i++){
:         new_pal.pal.palPalEntry[i].peRed=i;
:         new_pal.pal.palPalEntry[i].peGreen=i;
:         new_pal.pal.palPalEntry[i].peBlue=i;
:     }
:
:     bmp256->Palette=CreatePalette(&new_pal.pal);
:
:     for(int j=0;j<bmp256->Height;j++){
:         byte*s=(byte*)bmp->ScanLine[j];
:         byte*d=(byte*)bmp256->ScanLine[j];
:         for(int i=0;i<bmp256->Width;i++){
:             *(d+i)=(*(s+i*3+0)+*(s+i*3+1)+*(s+i*3+2))/3;
:         }
:     }
:
:     bmp256->SaveToFile("c:\\8bit.bmp");
:
:     delete bmp256;
:     delete bmp;
:
:
:
: 광땡 님이 쓰신 글 :
: : 24Bit BMP, JPG 파일을 Load하여 8Bit Gray로 변경하여 저장하고 싶은데
: : 어떻게 해야할지 모르겠네요.
: : 방법 좀 알려주세요.

+ -

관련 글 리스트
68249 컬러 영상(24Bit) 이미지를 Gray 8bit로 변경 방법 광땡 1355 2012/09/26
68265     Re:컬러 영상(24Bit) 이미지를 Gray 8bit로 변경 방법 방태윤 2256 2012/09/27
68267         Re:Re:컬러 영상(24Bit) 이미지를 Gray 8bit로 변경 방법 광땡 2011 2012/09/27
68268             jpg는 모르겠습니다.... 방태윤 1219 2012/09/27
68270                 감사합니다. 냉無 광땡 1166 2012/09/27
Google
Copyright © 1999-2015, borlandforum.com. All right reserved.