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毕 ...
随机推荐
- [BZOJ 3170] 松鼠聚会
Link: BZOJ 3170 传送门 Solution: $Knowledge Point:$ 切比雪夫距离$DIST(a,b)=max\{ |X'_a-X'_b|,|Y'_a-Y'_b|\}$ 曼 ...
- 【dfs序】【树状数组】bzoj1103 [POI2007]大都市meg
预处理出每个点到根节点的土路数,插到一个树状数组里,然后每次修改只会对子树中的节点造成影响,于是相当于区间修改.点查询了. #include<cstdio> using namespace ...
- 【二分答案】【分块答案】【字符串哈希】【set】bzoj2946 [Poi2000]公共串
我们二分/分块枚举答案x,暴力把除了最短的字符串以外的其他字符串的x长度子串哈希搞出来,分别扔到set里. 然后暴力枚举最短的字符串的x长度字串,查看是否在全部的set里出现过. #include&l ...
- Bean的装配方式
(一) 知识点:Spring容器支持多种形式的Bean的装配方式,比如基于XML的装配,基于注解的装配和自动装配(最常用的就是基于注解的装配) Spring提供了两种基于xml的装配方式:设值注入(S ...
- 苹果iOS系统下检查第三方APP是否安装及跳转启动
在iOS系统,使用Url Scheme框架在APP间互相跳转和传递数据,本文只介绍如果检测和跳转. Url Scheme框架 如果你想知道ios设备中是否安装QQ这个软件,我们可以通过一个简单方法判断 ...
- 排查java.lang.OutOfMemoryError: GC overhead limit exceeded
帮助客户排查java.lang.OutOfMemoryError: GC overhead limit exceeded错误记录: 具体网址: https://support.oracle.com/e ...
- shell用法 (cat << EOF)
下面的语句会创建不存在的secure.config,如果存在直接追加,然后把多行内容: [database] password = gerrit 写入文件secure.config ca ...
- ThinkPHP 3.0~3.2 注入漏洞
地址:http://xx.com/index.php/Admin.php?s=/User/Public/check payload:act=verify&username[0]=='1')) ...
- fl2440hello world模块驱动编写
许多语言,例如C,C++,JAVA等等都是从hello world开始的,因此我们的驱动程序的开发也要从hello world入手. 首先来看下我们的代码: /******************** ...
- struts2之ModelDriven的用法
在Struts 2中,提供了另外一种直接使用领域对象的方式,就是让action实现com.opensymphony. xwork2.ModelDriven接口.ModelDriven让你可以直接操作应 ...