3

I am trying to convert some image (raw) that has no header, just the pixel values to a png, so I can view it. I found some information here (using imageMagik) and it works if the image is one channel. I used the command

convert -depth 8 -size 5312x2988+0 gray:image.raw pic.png

I searched more and I found that using the rpg is a way to treat more channels image, so I changed the syntax to

convert -depth 8 -size 5312x2988+0 rgb:image.raw pic.png

... but the output seems to be more like a 9x9 matrix containing the small images, like

R R R
G G G
B B B

The size is not wrong, but it may be the way the pixels are stored (interlaced/not-interlaced).

Can anyone help me to convert the 3-channel image, the correct way?

sop
  • 3,445
  • 8
  • 41
  • 84
  • 2
    You could try specifying `-interlace plane` before the input file. Or maybe `-interlace line`. Or share the file and I will have a try. – Mark Setchell Feb 02 '17 at 17:16
  • What's generating the raw data? If the results are RRRGGGBBB, that makes me think it's not a 16bit stream. – emcconville Feb 02 '17 at 20:00
  • @emcconville sorry, it's a mistake there, I tried more things and it seems I copied the wrong line, the depth is 8 (I edited) – sop Feb 03 '17 at 07:16
  • @MarkSetchell that's it the planes were interlaced, you may put it into an answer, so I can accept it ;) – sop Feb 03 '17 at 07:25

1 Answers1

1

You could try specifying -interlace plane before the input file. Or maybe -interlace line, like this:

convert -interlace plane -depth 8 -size 5312x2988+0 rgb:image.raw pic.png

Like many ImageMagick parameters, you can enumerate the options at the command line with identify -list OPTION, so, in this case:

identify -list interlace

Output

Line
None
Plane
Partition
GIF
JPEG
PNG
Mark Setchell
  • 191,897
  • 31
  • 273
  • 432