Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the simplest RGB image format?

Tags:

c

image

raster

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); } 

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 

to:

offset 0000 : dword : magic        \      : /* ?? */              \ 0012 : dword : height         } Header <--> common image file 0016 : dword : width         /      : /* ?? */             / 0040 : height * width : data  } my data, 24bit RGB pixels 
like image 897
Nope Avatar asked May 19 '13 15:05

Nope


People also ask

What is RGB image format?

An RGB file is a color bitmap image, saved in a file format created by Silicon Graphics (SGI). It contains binary data used to show an image using the RGB color model. RGB files are similar to . SGI files.

What are the 3 types images format?

The PNG, JPEG, and GIF formats are most often used to display images on the Internet. Some of these graphic formats are listed and briefly described below, separated into the two main families of graphics: raster and vector.

What is the most common image format?

JPEG (. JPEG files are very common on the Internet and JPEG is a popular format for digital cameras - making it ideal for web use and non-professional prints.

What is the most web friendly image format?

Web Graphics: PNG, JPEG and GIF are the most web friendly image formats there is. JPEG is great for images when you need to keep the size small, such as when you need to upload it online. If you don't mind compromising the quality of the image a bit, use JPEG.


1 Answers

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

like image 185
Patrice Levesque Avatar answered Oct 04 '22 16:10

Patrice Levesque