Page 1 of 1

Raw GRAY/RGB images

Posted: 2006-10-09T16:09:13-07:00
by chanoy
Hi,

I'm trying to convert some raw (.gray, .rgb) images to ppm/pgm files. For gray images, I do something like

convert -size 1024x976 -depth 8 af1.gray af1.pgm

This works fine, however, I want to be able to have other options such as:

1.) specify file header size (meaning convert.exe will ignore the specified number of bytes at the beginning before converting the raw to pnm)
2.) For .rgb images, I would like to specific things like color order (RGB or BGR), Interleaved (RGB RGB... ) or Planar (RRR... GGG... BBB...), etc.

I'm not sure if ImageMagick has this type of options for converting raw to pnm. I was having trouble finding them.


Thanks for your time,
onyee

Posted: 2006-10-09T16:35:11-07:00
by chanoy
I found out how to add a header:

convert -depth 8 -size 1024x976+128 af1.gray af1.pgm

but i still trying to look for the other options I mentioned above.

Posted: 2006-10-09T17:22:47-07:00
by magick
You can set interleaving with the -interlace option. You can grab pixel components in any order with the ImageMagick API but currently there is no method to read raw pixels in any order from the command line.

Posted: 2006-10-10T18:41:17-07:00
by anthony
There are othe runix commands that can handle file streams.

For example the UNIX 'dd' command can be used to remove 'X' bytes from the start of a character stream.

If the file is line orientated the comman 'tail' can be used to ignore say the first 2 lines
of a file.

IM Commands can read images from pipelines do you can just 'pipe' the output of one of these filters into IM.