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毕 ...
随机推荐
- 输入参数之POJO包装类
1,包装类:需要实现序列化 package com.songyan.pojo; import java.io.Serializable; public class QueryVo implements ...
- Asp.Net MVC part1
路由简介在Global中注册了路由数据包括:默认Controller,默认Action,请求地址匹配路由规则 约定大于配置为了尽量少的配置,于是将常用的配置作为默认约定,如果不同则进行少量配置主要从存 ...
- catalina_home与catalina_base
CATALINA_HOME是Tomcat的安装目 录,CATALINA_BASE是Tomcat的工作目录. 如果我们想要运行Tomcat的多个实例,但是不想安装多个Tomcat软件副本.那么我们可以配 ...
- Jackson错误:Can not deserialize instance of java.lang.String out of START_OBJECT token
org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Can not des ...
- Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明
Oracle的取整和四舍五入函数——floor,round,ceil,trunc使用说明 FLOOR——对给定的数字取整数位SQL> select floor(2345.67) from dua ...
- C# 6.0语法新特性体验(二)
之前我在文章通过Roslyn体验C# 6.0的新语法中介绍了一些C# 6.0的语法特性,现在随着Visual Studio 14 CTP3的发布,又陆续可以体验一些新的特性了,这里简单的介绍一下之前没 ...
- Delphi制作软键盘
{ 作者: han 日期: 2006.06.02 } unit softkey; interface uses Windows, Messages, SysUtils, Variants, C ...
- RedisTemplate SerializationFailedException: Failed to deserialize payload 异常解决
问题描述: 使用RedisTemplate(spring-data-redis )进行redis操作的封装 , 现有一个incr的key , 当调用incr后返回值一切正常, 当对此key进行get调 ...
- MR hadoop streaming job的学习 combiner
代码已经拷贝到了公司电脑的: /Users/baidu/Documents/Data/Work/Code/Self/hadoop_mr_streaming_jobs 首先是主控脚本 main.sh 调 ...
- Excel的列数以数字格式查看
1.Excel中的列数默认是以字母形式显示的,当我们有大量数据并想知道任一数据是第多少行多少列时这样就不方便了,我们可以通过如下设置来达到让EXCEL以数字形式显示行数和列数的效果. 2.点击文件-- ...