raw파일을 bmp파일로 변환하려고 합니다.
접시
질문 제목 :
raw파일을 bmp파일로 변환하려고 합니다.
raw파일을 bmp파일로 변환하려고 합니다.
raw파일을 rgb로 나누는 것 까지는 했는데요...이걸 다시 bmp로 만들고 싶습니다.
어떻게 해야하는지 방향좀 잡아주세요
제발 부탁드립니다.
질문 내용 : #include stdio.h#pragma pack(1) //1바이트 단위로 정렬
struct buf_bitmapfileheader //bitmap file header를 받을 구조체
{
unsigned short buf_identity;
unsigned int buf_file_size;
unsigned short buf_reserved1;
unsigned short buf_reserved2;
unsigned int buf_data_offset;
};
#pragma pack() //기본값 복원#pragma pack(1)
struct buf_bitmapinfoheader //bitmap info header를 받을 구조체
{
unsigned int buf_header_size;
int buf_width;
int buf_height;
unsigned short buf_planse;
unsigned short buf_bit_per_pixel;
unsigned int buf_compression;
unsigned int buf_data_size;
int buf_hresolution;
int buf_vresolution;
unsigned int buf_used_colors;
unsigned int buf_important_colors;
};
#pragma pack() struct buf_bitmapfileheader bfh;
struct buf_bitmapinfoheader bih;
char bmp[516*339*3]; //너비는 4의 배수
char red[516*339*3];int main(void)
{
unsigned char *bf1,*bfr,*bfg,*bfb; // 버퍼포인터
file *fp1,*fp2,*fp3,*fp4; // 파일포인터
int i; // 변수 i 생성
// 버퍼생성
bf1 = (unsigned char*)malloc(sizeof(unsigned char)*512*512*3);
bfr = (unsigned char*)malloc(sizeof(unsigned char)*512*512);
bfg = (unsigned char*)malloc(sizeof(unsigned char)*512*512);
bfb = (unsigned char*)malloc(sizeof(unsigned char)*512*512);
// 이미지 파일 읽어들임
fp1 = fopen(lena512color.raw,rb);
fread(bf1,sizeof(,sizeof(unsigned char),512*512*3,fp1);
// 색상분할
for(i=0;i512*512;i++)
{
bfr[i] = bf1[3*i];
bfg[i] = bf1[3*i+1];
bfb[i] = bf1[3*i+2];
}
\\\\\\\\\\\\\\\\\\\\\
}
-
예린
안녕하세요. 관심가져주셔서 감사합니다. 제가 지금 밖에 있어서 첨부를 할 수 가 없네요 ㅠㅠ
8시에 집에가는 대로 바로 첨부해서 여쭤보겠습니다.
감사합니다. -
다은
raw file을 첨부해주세요.
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2698994 | 날짜 계산하는 C 코드 짜고 있는데 꽉 막혀서 질문드립니다.. (6) | 별 | 2025-06-22 |
2698967 | 파일삭제 윈도우 폴더까지 접근하게하는 함수가 뭔가요 (2) | 샤인 | 2025-06-21 |
2698938 | c언어 메모리질문 (3) | 나래 | 2025-06-21 |
2698909 | 서비스 요청 고객 관리 프로그램 짜는것좀 도와주세요ㅜㅜ (4) | 궁수자리 | 2025-06-21 |
2698882 | 프로그래밍좀 짜주세요 (3) | 황예 | 2025-06-21 |
2698855 | 카프-라빈 알고리즘 코딩 분석좀 도와주세요.. | 꽃봄 | 2025-06-20 |
2698829 | 학점계산기 (7) | MyWay | 2025-06-20 |
2698782 | 기초적인 함수 질문이요ㅠㅠㅠㅠ | 내담 | 2025-06-20 |
2698749 | 프로그램 짜던 도중 패닉입니다...ㅜ | 파랑 | 2025-06-19 |
2698719 | 조건부컴파일 질문입니다.~ (2) | 큐트 | 2025-06-19 |
2698693 | 재귀 함수 에러 | 바닐라 | 2025-06-19 |
2698673 | 고민이있는데 들어좀주세요!! (1) | 초코맛캔디 | 2025-06-19 |
2698644 | 1부터 n까지의 합을 구하는데 엄청긴숫자의 합을 구할때는 어떻게 해야하나요? (4) | 슬우 | 2025-06-18 |
2698616 | 다른 함수로 안넘어갑니다..;;; | 도1도캣 | 2025-06-18 |
2698587 | 배열하다 막혀서... (3) | WhiteCat | 2025-06-18 |
2698559 | 문자열을 비우는방법 (2) | 하늘 | 2025-06-18 |
2698528 | 착하고 친절한 선생씌구해염~ㅋㅋ (4) | 옆집언니야 | 2025-06-17 |
2698502 | 자료구조 큐 | 캔서 | 2025-06-17 |
2698477 | 실행화면 배경문의요 | 선아 | 2025-06-17 |
2698430 | 변수의 값이 저장이 않되네요;; (4) | 피네 | 2025-06-16 |