mirror of
https://github.com/haraldk/TwelveMonkeys.git
synced 2026-05-01 00:00:02 -04:00
#628 TIFF metadata fix, now always outputs denominator for rationals.
+ Bonus: Added JAI TIFF interop module with test and other minor fixes.
This commit is contained in:
+7
-2
@@ -100,7 +100,7 @@ public final class TIFFImageMetadata extends AbstractMetadata {
|
||||
* {@link #setFromTree(String, Node)}
|
||||
* or {@link #mergeTree(String, Node)} methods.
|
||||
*/
|
||||
public TIFFImageMetadata(final Collection<Entry> entries) {
|
||||
public TIFFImageMetadata(final Collection<? extends Entry> entries) {
|
||||
this(new IFD(entries));
|
||||
}
|
||||
|
||||
@@ -196,7 +196,12 @@ public final class TIFFImageMetadata extends AbstractMetadata {
|
||||
elementNode.setAttribute("value", String.valueOf((Short) value & 0xFFFF));
|
||||
}
|
||||
else if (unsigned && value instanceof Integer) {
|
||||
elementNode.setAttribute("value", String.valueOf((Integer) value & 0xFFFFFFFFl));
|
||||
elementNode.setAttribute("value", String.valueOf((Integer) value & 0xFFFFFFFFL));
|
||||
}
|
||||
else if (value instanceof Rational) {
|
||||
// For compatibility with JAI format, we need denominator
|
||||
String rational = String.valueOf(value);
|
||||
elementNode.setAttribute("value", rational.indexOf('/') < 0 && !"NaN".equals(rational) ? rational + "/1" : rational);
|
||||
}
|
||||
else {
|
||||
elementNode.setAttribute("value", String.valueOf(value));
|
||||
|
||||
Reference in New Issue
Block a user