[vtkusers] read raw image

Jeremy Winston winston at cat.rpi.edu
Tue Apr 15 13:39:33 EDT 2003


marisa aurelio wrote:
> I have a doubt about reading raw images.
> I know that raw images can be read on IrfanView by they ask for the 
> "File Header Size" and I don't know how to get it!!!

You have to know the pixel width & height, w & h, of the image.
If you know them, you can compute the header size:

   Header_size = File_size - w*h*bytes_per_pixel

since by definition, the header comes at the head of the file,
before the data.  Bytes_per_pixel is usually 1 or 2.

Unfortunately, it is also possible that there is a "trailer" of
pad bytes, so this method is not foolproof. But its a place to start.

HTH,
-Jeremy





More information about the vtkusers mailing list