<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Thanks Curtis,<br>
<br>
for now i'll just use tiffinfo to extract the XML i need..<br>
<br>
#!/bin/sh <br>
INFO=$(tiffinfo "$1" 2>&1 | sed -r -n -e '/Warning/b' -e
's/.*Tag 50839: *//p')<br>
<br>
doit() { <br>
node | xmlstarlet fo <br>
} <br>
<br>
doit << EOF <br>
console.log( <br>
new Buffer([$INFO]) <br>
.toString('utf8') <br>
.replace(/\0|\n/g,'') <br>
.replace(/^[^<]+<\?xml/,'<?xml') <br>
.replace(/\/properties>.*/,'/properties>')<br>
); <br>
EOF <br>
<br>
On 22/10/13 18:10, Curtis Rueden wrote:<br>
</div>
<blockquote
cite="mid:CADN69ymtncvOp3-hqSjJYXnPd=jLr3E20D9bVcmLz060YkBHdg@mail.gmail.com"
type="cite">
<div dir="ltr">Hi Luc,
<div><br>
</div>
<div>
<div>> I cannot figure out how to access metadata('Info')
in a TIFF file,</div>
<div>> without launching ImageJ in batch mode to call
getMetadata('Info')</div>
<div>> ...</div>
<div>> </div>
<div>> Is it possible with FreeImage or any other C library
?..</div>
</div>
<div><br>
</div>
<div>The metadata text is written out to the TIFF using custom
tags 50838 and 50839.</div>
<div>
<br>
</div>
<div>Using libtiff's tiffinfo command line tool, you'll see
something like:</div>
<div><br>
</div>
<div> Tag 50839:
73,74,73,74,105,110,102,111,0,0,0,1,0,72,0,101,0,108,0,108,0,111,0,32,0,119,0,111,0,114,0,108,0,100,0,46,0,46,0,46,0,10,0,71,0,114,0,101,0,97,0,116,0,46<br>
</div>
<div><br>
</div>
<div>Which must then be decoded to a string.</div>
<div><br>
</div>
<div>Source code at:</div>
<div><a moz-do-not-send="true"
href="https://github.com/fiji/ImageJA/blob/v1.48e/src/main/java/ij/io/TiffEncoder.java#L355">https://github.com/fiji/ImageJA/blob/v1.48e/src/main/java/ij/io/TiffEncoder.java#L355</a><br>
</div>
<div><a moz-do-not-send="true"
href="https://github.com/fiji/ImageJA/blob/v1.48e/src/main/java/ij/io/TiffDecoder.java#L43">https://github.com/fiji/ImageJA/blob/v1.48e/src/main/java/ij/io/TiffDecoder.java#L43</a><br>
</div>
<div><br>
</div>
<div>
Regards,</div>
<div>Curtis</div>
<div><br>
</div>
<div>P.S. Looks like someone submitted a patch to support this
in Pillow, but it is not yet merged:</div>
<div><a moz-do-not-send="true"
href="https://github.com/python-imaging/Pillow/issues/291">https://github.com/python-imaging/Pillow/issues/291</a>.
Who knows what other software already supports it.<br>
</div>
</div>
<div class="gmail_extra"><br>
<br>
<div class="gmail_quote">On Tue, Oct 22, 2013 at 10:30 AM, Luc
Deschenaux <span dir="ltr"><<a moz-do-not-send="true"
href="mailto:luc@miprosoft.com" target="_blank">luc@miprosoft.com</a>></span>
wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0
.8ex;border-left:1px #ccc solid;padding-left:1ex">Hi,<br>
<br>
I cannot figure out how to access metadata('Info') in a TIFF
file, without launching ImageJ in batch mode to call
getMetadata('Info') ...<br>
<br>
Is it possible with FreeImage or any other C library ?..<br>
<br>
Regards,<br>
<br>
Luc<br>
<br>
_______________________________________________<br>
ImageJ-devel mailing list<br>
<a moz-do-not-send="true"
href="mailto:ImageJ-devel@imagej.net" target="_blank">ImageJ-devel@imagej.net</a><br>
<a moz-do-not-send="true"
href="http://imagej.net/mailman/listinfo/imagej-devel"
target="_blank">http://imagej.net/mailman/listinfo/imagej-devel</a><br>
</blockquote>
</div>
<br>
</div>
</blockquote>
<br>
<br>
<pre class="moz-signature" cols="72">--
Luc Deschenaux
t: +41 788 266 366
v: +41 225 085 085 @ netvoip.ch</pre>
</body>
</html>