当前位置: 技术问答>linux和unix
谁用libjpeg处理过jpeg文件,能不能给点例子
来源: 互联网 发布时间:2015-03-27
本文导语: 我的邮箱是zhl_tsh_2000@sina.com,多谢了,在线等待 | 编码过程如下 struct jpeg_compress_struct cjpeg; struct jpeg_error_mgr jerr; JSAMPROW row_ptr[1]; line=malloc(vconf->win.width * 3); if (!line) ...
我的邮箱是zhl_tsh_2000@sina.com,多谢了,在线等待
|
编码过程如下
struct jpeg_compress_struct cjpeg;
struct jpeg_error_mgr jerr;
JSAMPROW row_ptr[1];
line=malloc(vconf->win.width * 3);
if (!line)
v_error(vconf, LOG_CRIT, "OUT OF MEMORY, Exiting..."); // exit
cjpeg.err = jpeg_std_error(&jerr);
jpeg_create_compress (&cjpeg);
cjpeg.image_width = vconf->win.width;
cjpeg.image_height= vconf->win.height;
cjpeg.input_components = 3;
cjpeg.in_color_space = JCS_RGB;
jpeg_set_defaults (&cjpeg);
jpeg_set_quality (&cjpeg, DEFAULT_QUALITY, TRUE);
cjpeg.dct_method = JDCT_FASTEST;
jpeg_stdio_dest (&cjpeg, x);
jpeg_start_compress (&cjpeg, TRUE);
row_ptr[0]=line;
line_width=vconf->win.width * 3;
n=0;
for (y = 0; y win.height; y++)
{
for (i = 0; i Options.xsize) ||
(image.output_height > Options.ysize) ) {
image.scale_denom++;
jpeg_calc_output_dimensions(&image);
}
buff = (unsigned char *)malloc(image.output_width * image.output_components);
if (!buff) {
jpeg_destroy_decompress(&image);
ggiPanic("Could not allocate memory!n");
exit(1);
}
startx = (Options.xsize - image.output_width) / 2;
starty = (Options.ysize - image.output_height) / 2;
jpeg_start_decompress(&image);
InitScreen(filename);
while (image.output_scanline
struct jpeg_compress_struct cjpeg;
struct jpeg_error_mgr jerr;
JSAMPROW row_ptr[1];
line=malloc(vconf->win.width * 3);
if (!line)
v_error(vconf, LOG_CRIT, "OUT OF MEMORY, Exiting..."); // exit
cjpeg.err = jpeg_std_error(&jerr);
jpeg_create_compress (&cjpeg);
cjpeg.image_width = vconf->win.width;
cjpeg.image_height= vconf->win.height;
cjpeg.input_components = 3;
cjpeg.in_color_space = JCS_RGB;
jpeg_set_defaults (&cjpeg);
jpeg_set_quality (&cjpeg, DEFAULT_QUALITY, TRUE);
cjpeg.dct_method = JDCT_FASTEST;
jpeg_stdio_dest (&cjpeg, x);
jpeg_start_compress (&cjpeg, TRUE);
row_ptr[0]=line;
line_width=vconf->win.width * 3;
n=0;
for (y = 0; y win.height; y++)
{
for (i = 0; i Options.xsize) ||
(image.output_height > Options.ysize) ) {
image.scale_denom++;
jpeg_calc_output_dimensions(&image);
}
buff = (unsigned char *)malloc(image.output_width * image.output_components);
if (!buff) {
jpeg_destroy_decompress(&image);
ggiPanic("Could not allocate memory!n");
exit(1);
}
startx = (Options.xsize - image.output_width) / 2;
starty = (Options.ysize - image.output_height) / 2;
jpeg_start_decompress(&image);
InitScreen(filename);
while (image.output_scanline
您可能感兴趣的文章:
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。
站内导航:
特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!