On Sun, 29 Jun 2014 11:22:07 +0200, Mario Emmenlauer wrote:
>Did you see if the comment is just a single string, possibly >separated by newline, or if its indeed an array of comments?
It is simply a string. E.g.
openjpeg-1.5.x-branch-r2871/applications/codec/image_to_j2k.c:
main()
{
case 'C': /* add a comment */
{
parameters->cp_comment = (char*)malloc(strlen(opj_optarg) + 1);
if(parameters->cp_comment) {
strcpy(parameters->cp_comment, opj_optarg);
}
}
break;
}
void j2k_setup_encoder(opj_j2k_t *j2k,
opj_cparameters_t *parameters, opj_image_t *image)
{
if(parameters->cp_comment) {
cp->comment = (char*)opj_malloc(strlen(parameters->cp_comment) + 1);
if(cp->comment) {
strcpy(cp->comment, parameters->cp_comment);
}
}
}
opj_bool j2k_encode(opj_j2k_t *j2k, opj_cio_t *cio,
opj_image_t *image, opj_codestream_info_t *cstr_info)
{
if (j2k->cp->comment != NULL) {
j2k_write_com(j2k);
}
}
static void j2k_write_com(opj_j2k_t *j2k) {
unsigned int i;
int lenp, len;
if(j2k->cp->comment) {
opj_cio_t *cio = j2k->cio;
char *comment = j2k->cp->comment;
cio_write(cio, J2K_MS_COM, 2);
lenp = cio_tell(cio);
cio_skip(cio, 2);
cio_write(cio, 1, 2); /* General use (IS 8859-15:1999
// ===
(Latin) values) */
for (i = 0; i < strlen(comment); i++) {
cio_write(cio, comment[i], 1);
}
len = cio_tell(cio) - lenp;
cio_seek(cio, lenp);
cio_write(cio, len, 2);
cio_seek(cio, lenp + len);
if(j2k->cstr_info)
j2k_add_mhmarker(j2k->cstr_info, J2K_MS_COM, lenp, len);
}
}
And you can see: the underlined value is '1' only.
For an array one needs perhaps:
struct comment{ short type; char *text; };
short nr_of_comments;
struct comments[];
because we can have at least 3 types:
0: "General use (binary values)"
1: "General use (ISO 8859-1 (latin-1) values)"
2: "Reserved use"
Comments in your file:
[83]marker(0xff64)
com len(53)
R[1](General use (ISO 8859-1 (latin-1) values))
T(Filename=b0bCDME-0007_wB05_s1_z1_t1_cGFP_u001.tif)
[138]marker(0xff64)
com len(15)
R[1](General use (ISO 8859-1 (latin-1) values))
T(SiteIndex=1)
(...)
Do you know a viewer that does show the 16-Bit file
b0bCDME-0007_wB05_s1_z1_t1_cGFP_u001.jp2
not as a black image?
winfried