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을 첨부해주세요.
번호 | 제 목 | 글쓴이 | 날짜 |
---|---|---|---|
2692210 | 정보 올림피아드 문제인데.. 풀이 과정이 궁금합니다.(재귀함수) (5) | 물티슈 | 2025-04-20 |
2692144 | C언어와 리눅스에 대한 질문입니다. | 싴흐한세여니 | 2025-04-20 |
2692114 | 컨텍스트 스위칭하는데 걸리는 시간 측정.. | YourWay | 2025-04-19 |
2692086 | 간접참조 연산자, 증감연산자 질문이용! (2) | 블랙캣 | 2025-04-19 |
2692056 | 주석좀 달아주세요. 몇개적엇는데 몇개만달아주세요. (2) | DevilsTears | 2025-04-19 |
2691978 | 진수 쉽게 이해하는법... (3) | 지지않는 | 2025-04-18 |
2691949 | getchar() 한 문자를 입력받는 함수 질문 | 채꽃 | 2025-04-18 |
2691919 | 배열 정렬 및 합치기 질문입니다. | 사과 | 2025-04-18 |
2691845 | c언어왕초보 질문이 있습니다........ | 루나 | 2025-04-17 |
2691815 | void add(int num); 함수... (4) | 살랑살랑 | 2025-04-17 |
2691756 | 명령 프롬프트 스크롤바가 없어요 | 두메꽃 | 2025-04-16 |
2691725 | 자료구조에 관련해서 질문이 있어 글을 올립니다. | 누리알찬 | 2025-04-16 |
2691697 | if 문에서 구조체 배열에 저장되있던 문자열 검사하는 법 ? (2) | 민트맛사탕 | 2025-04-16 |
2691678 | C언어 함수 질문이요~!!! | 연보라 | 2025-04-15 |
2691650 | 반복문 | 돋가이 | 2025-04-15 |
2691618 | 링크드리스트 개념 질문이예요 (3) | 맨마루 | 2025-04-15 |
2691592 | 동적할당 이용 배열선언 질문입니다.ㅠㅠ (3) | 허리달 | 2025-04-15 |
2691542 | /=의 용도를 알려주세요 ㅠㅠ! (2) | 아라 | 2025-04-14 |
2691510 | sizeof 연산자 질문입니다 (2) | 종달 | 2025-04-14 |
2691483 | 파일 오픈시 에러 질문드립니다. (2) | 호습다 | 2025-04-14 |