@ade
The usual conversion is from SOURCE to JPEG2000. SOURCE may be
a (GRAY | GRAYA | RGB | RGBA) buffer. The JPEG2000 destination
is a complete JPEG2000 file, not an e.g. RGB-buffer.
The JPEG2000 file does contains some header information and some
data information. The same holds for a TIFF file.
So the question is whether you want a complete JPEG2000 file or
RGB data only. The RGB data is either in your SOURCE buffer; or
in the openjpeg image where you can find the e.g. RGB data in the
image->comps[0].data, image->comps[1].data, image->comps[2].data .
A pyramid.tif file usually does contain TIFF images. But if you do want
JPEG2000 images instead, you have to use JPEG2000 files.
In case this assumption is correct you have to convert RGB-SOURCE
buffer to JPEG2000-DEST file.
Supposed this is true, I have some code for you.
winfried