ffffff
http://www.ibm.com/developerworks/cn/linux/l-cn-linuxglb/
http://blog.csdn.net/wocjj/article/details/7867191
int read_JPEG_file (char * filename)
{
struct jpeg_decompress_struct cinfo;
struct jpeg_error_mgr jerr;
FILE * infile; /* source file */
FILE * outfile; /* source file */
JSAMPARRAY buffer; /* Output row buffer */
int row_stride; /* physical row width in output buffer */
//unsigned int nWidth = 1280;
//unsigned int nHeight = 720;
unsigned char* pcOutBuf = NULL;
char* pcRowBuf = NULL;
if ((infile = fopen(filename, "rb")) == NULL)
{
fprintf(stderr, "can't open %s\n", filename);
return 0;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, infile);
(void) jpeg_read_header(&cinfo, TRUE);
printf("width=%d, height=%d\n", cinfo.image_width, cinfo.image_height);
printf("color components:%d, jpeg color space:%d\n", cinfo.num_components, cinfo.jpeg_color_space);
printf("decompress--->color components:%d, jpeg color space:%d\n", cinfo.out_color_components, cinfo.out_color_space);
//printf("out_width=%d, out_height=%d\n", cinfo.output_width, cinfo.output_height);
//printf("component=%d\n", cinfo.output_components);
cinfo.out_color_space=JCS_GRAYSCALE;
cinfo.out_color_components = 1;
//jpeg_set_colorspace(&cinfo, JCS_GRAYSCALE);
//执行jpeg_start_decompress后才能获取到上面的打印信息
(void) jpeg_start_decompress(&cinfo);
printf("out_width=%d, out_height=%d\n", cinfo.output_width, cinfo.output_height);
printf("component=%d\n", cinfo.output_components);
printf("decompress--->color components:%d, jpeg color space:%d\n", cinfo.out_color_components, cinfo.out_color_space);
row_stride = cinfo.output_width * cinfo.output_components;
pcOutBuf = (unsigned char*)malloc(cinfo.output_width*cinfo.output_height*cinfo.output_components);
pcRowBuf = (char*)malloc(row_stride);
if ((outfile = fopen("xxx.gray", "wb")) == NULL)
{
fprintf(stderr, "can't open %s\n", "xxx.gray");
return 0;
}
while (cinfo.output_scanline < cinfo.output_height)
{
(void) jpeg_read_scanlines(&cinfo, &pcRowBuf, 1);
memcpy(pcOutBuf, pcRowBuf, row_stride);
pcOutBuf += row_stride;
fwrite(pcRowBuf,1, row_stride, outfile);
// printf("cinfo.output_scanline=%d\n", cinfo.output_scanline);
}
fclose(infile);
fclose(outfile);
if (NULL != pcOutBuf)
free(pcOutBuf);
return 0;
}
ffffff的更多相关文章
- 颜色代码表#FFFFFF #FF0000 #00FF00 #FF00FF (2015-07-21 10:39)转载
▼标签: 颜色代码表 白色 ffffff 红色 ff0000 黑色 000000 it 分类: hht1 白色 #FFFFFF 2 红色 #FF0000 3 绿色 #00FF00 4 蓝色 # ...
- 颜色设置 <color name="white">#FFFFFF</color><!--白色 -->
<?xml version="1.0" encoding="utf-8"?> <resources> <color name=&q ...
- android 在代码中使用 #ffffff 模式 设置背景色
differentsum.setBackgroundColor(Color.parseColor("#F3733F"));
- C语言中以十六进制输出字符型变量会出现'ffffff"的问题
最近在做一个C的嵌入式项目,发现在C语言中用printf()函数打印字符型变量时,如果想采用"%x"的格式将字符型变量值以十六进制形式打印出来,会出现一个小问题,如下: char ...
- RGB(FFFFFF)转255:255:255
NSString *color = model.display_color; long colorLong = strtoul([color cStringUsingEncoding:NSUTF8St ...
- iOS可视化动态绘制连通图
上篇博客<iOS可视化动态绘制八种排序过程>可视化了一下一些排序的过程,本篇博客就来聊聊图的东西.在之前的博客中详细的讲过图的相关内容,比如<图的物理存储结构与深搜.广搜>.当 ...
- 纯CSS3实现的一些酷炫效果
之前在网上看到一些用纯CSS3实现的酷炫效果,以为实现起来比较困难,于是想看看具体是怎么实现的. 一.笑脸猫动画 实现效果如下: 这个实现起来确实比较麻烦,很多地方需要花时间,有耐心地调整. 1.先看 ...
- FragmentTabHost的基本用法
开通博客以来已经约莫1个月了.几次想提笔写写东西,但总是由于各种各样的原因并没有开始.现在,年假刚结束,项目也还没有开始,但最终促使我写这篇博客的是,看了一篇博友写的新年计划,说是要在新的一年中写50 ...
- QT5利用chromium内核与HTML页面交互
在QT5.4之前,做QT开发浏览器只能选择QWebkit,但是有过使用的都会发现,这个webkit不是出奇的慢,简直是慢的令人发指,Release模式下还行,debug下你就无语了,但是webkit毕 ...
随机推荐
- POJ 3709 K-Anonymous Sequence(斜率优化DP)
[题目链接] http://poj.org/problem?id=3709 [题目大意] 给出一个长度为n个非严格单调递增数列,每次操作可以使得其中任意一项减一, 问现在使得数列中每项数相同的数的数量 ...
- 【计算几何】 Codeforces Beta Round #67 (Div. 2) E. Ship's Shortest Path
读懂题意其实是模板题.就是细节略多. #include<cstdio> #include<cmath> #include<algorithm> using name ...
- @RequestMapping注解的使用,Controller方法返回值
1,web.xml <?xml version="1.0" encoding="UTF-8"?> <web-app version=" ...
- linux的打包与解压
zip: 打包 :zip something.zip something (目录请加 -r 参数) 解包:unzip something 指定路径:-d 参数 创建加密 zip 包 使用 -e 参数可 ...
- MathType输入矩阵或者向量的注意事项
如图A区域是换行搞得,BC是插入矩阵,AC明显看着不一样,就是说行间不要使用换行,列间隔不要用空格(ctrl+shift+space),直接插入矩阵,向量就是矩阵的行或者列数目是1. 还有就是需要注意 ...
- 【mybatis】mybatis 中update 更新操作,null字段不更新,有值才更新
示例代码如下: <update id="updateGoodsConfigQuery" parameterType="com.pisen.cloud.luna.ms ...
- nfs mount 故障 mount.nfs: access denied by server while mounting 10.0.100.208:/backup_usb
生产环境: 服务端centos7.2,客户端:ubuntu16.04 挂载出现的故障: root@HDCtrl100:/mnt# mount -t nfs 10.0.100.208:/backup_u ...
- BSP
1 BSP概述 BSP即Board Support Package,板级支持包.它来源于嵌入式操作系统与硬件无关的设计思想,操作系统被设计为运行在虚拟的硬件平台上.对于具体的硬件平台,与硬 ...
- JS中map、forEach、filter、reduce等Array新增方法的区别
数组在各个编程语言中的重要性不言而喻,但是在之前的JavaScript中数组虽然功能已经很强大,但操作方法并不完善,在ECMAScript5中做了适当的补充. Array.isArray(elemen ...
- 【重点突破】—— 当better-scroll 遇见Vue
前言:在学习黄轶老师的<Vue.js高仿饿了么外卖App>课程中接触到了better-scroll第三方JavaScript组件库,这是黄轶老师自己基于iscroll重写的库.这里结合黄轶 ...