什么是最简单的RGB图像格式? [英] What is the simplest RGB image format?

查看:279
本文介绍了什么是最简单的RGB图像格式?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在C对物理实验工作,杨氏干涉实验和我犯了一个程序谁打印到文件像素的庞大的一群:

I am working in C on a physics experiment, Young's interference experiment and i made a program who prints to file a huge bunch of pixels :

for (i=0; i < width*width; i++)
{
    fwrite(hue(raster_matrix[i]), 1, 3, file);
}

其中,色相,给定值[0..255]的时候,还给一个的char * 3字节,R,G,B。

Where hue, when given a value [0..255], gives back a char * with 3 bytes, R,G,B.

我想提出一个最小的头在我的图像文件,以使该原始文件中的有效的图像文件。

I would like to put a minimal header in my image file in order to make this raw file a valid image file.

更简洁:
从切换:

More concise : Switching from :

offset
0000 : height * width : data } my data, 24bit RGB pixels

offset
0000 : dword : magic        \
     : /* ?? */              \
0012 : dword : height         } Header <--> common image file
0016 : dword : width         /
     : /* ?? */             /
0040 : height * width : data  } my data, 24bit RGB pixels

感谢您。

推荐答案

您可能要使用 PPM格式这是你要寻找的:一个最小的头,后跟原始RGB

You probably want to use the PPM format which is what you're looking for: a minimal header followed by raw RGB.

这篇关于什么是最简单的RGB图像格式?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆