#include <stdio.h>
#include "jpeglib.h"
#include <setjmp.h>
int main(int argc,char **argv)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE *infile;
cinfo.err=jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
if((infile=fopen(argv[1],"rb"))==NULL)
{
fprintf(stderr, "can't open %s\n", argv[1]);
return -1;
}
jpeg_stdio_src(&cinfo,infile);
jpeg_read_header(&cinfo,TURE);
/* 源信息 */
printf("image_width = %d\n", cinfo.image_width);
printf("image_height = %d\n", cinfo.image_height);
printf("num_components = %d\n", cinfo.num_components);
// 设置解压参数,比如放大、缩小
//解出来的图像大小就是scale_num/scale_denom,jpeg当前仅支持1/1, 1/2, 1/4,和1/8
printf("enter M/N:\n");
scanf("%d/%d", &cinfo.scale_num, &cinfo.scale_denom);
printf("scale to : %d/%d\n", cinfo.scale
jpeg入门2学习笔记
最新推荐文章于 2024-04-19 16:42:01 发布
![](https://img-home.csdnimg.cn/images/20240711042549.png)