off[i] = i;
SampleModel sm = new PixelInterleavedSampleModel
(DataBuffer.TYPE_BYTE, w, h, bands, w * bands, off);
RenderedImage rimg = new FormatRed(GraphicsUtil.wrap(img), sm);
writer.writeImage(rimg, ostream, params);
ostream.flush();
} catch (IOException ex) {
throw new TranscoderException(ex);
}
}