Converting a Pixel Interleaved Image to Band Interleaved
QUESTION: Is there a simple way of converting a pixel interleaved image to a band or row interleaved image? I can do it, but the way I'm doing it seems more brute force than elegant.
ANSWER: Yes, the Transpose function is just what you want. Try opening the rose.jpg file, which is a pixel interleaved image, like this:
IDL> filename = Filepath(SubDirectory=['examples','data'], 'rose.jpg') IDL> Read_JPEG, filename, rose IDL> Help, rose ROSE BYTE = Array[3, 227, 149]
To make this is band interleaved image, we do this:
IDL> newrose = Transpose(rose, [1,2,0]) IDL> Help, newrose NEWROSE BYTE = Array[227, 149, 3]
To make it a row interleaved image, we do this:
IDL> newrose = Transpose(rose, [1,0,2]) IDL> Help, newrose NEWROSE BYTE = Array[227, 3, 149]
Copyright © 1997-2003 David W. Fanning
Last Updated 3 January 2003