c - What is the simplest RGB image format? -
i working in c on physics experiment, young's interference experiment , made program prints file
huge bunch of pixels :
for (i=0; < width*width; i++) { fwrite(hue(raster_matrix[i]), 1, 3, file); }
where hue
, when given value [0..255], gives char *
3 bytes, r,g,b.
i put minimal header in image file in order make raw file valid image file.
more concise : switching :
offset 0000 : height * width : data } data, 24bit rgb pixels
to
offset 0000 : dword : magic \ : /* ?? */ \ 0012 : dword : height } header <--> common image file 0016 : dword : width / : /* ?? */ / 0040 : height * width : data } data, 24bit rgb pixels
thank you.
you want use ppm format you're looking for: minimal header followed raw rgb.
Comments
Post a Comment