int w = cinfo.image_width;
int h = cinfo.image_height;
int d = cinfo.jpeg_color_space;
int out_h = cinfo.output_height;
printf("width:%d height:%d depth:%d out_height:%d\n", w, h ,d, out_h);
unsigned char *data = new unsigned char[w * h * d];
while (cinfo.output_scanline < cinfo.output_height)
{
jpeg_read_scanlines(&cinfo, &data, 1);
data += d * cinfo.output_width;
}
jpeg_read_header() 한뒤
jpeg_read_scanline()까지는 알았지만, 문서를 대충 읽다 보니..
도무니 어떻게 메모리를 할당해야 할지 감이 안 잡혔는데..
이 문서를 보니 어떻게 하면 될꺼 같다라는 감이 조금은 온다..
내일 해보고 결과를 적도록 해야겠다.
위에서 대로 전체 할당하고 jpeg_read_scanlines로 읽어 오니 잘된다!
[링크 : http://www.korone.net/bbs/board.php?bo_table=etc_misc&wr_id=168]
'프로그램 사용 > libjpeg' 카테고리의 다른 글
| libjpeg 크로스컴파일 하기 - libjpeg cross-compile using libtool (0) | 2009.05.20 |
|---|---|
| libjpeg - jmorecfg.h (0) | 2009.05.19 |
| libtool: link: unable to infer tagged configuration (0) | 2009.05.18 |
| libjpeg.doc 내용 중 scale / decompress 관련내용 (0) | 2009.05.18 |
| libjpeg 사용시 color depth (4) | 2009.05.15 |