// coordinate system used for regions and crop bounds:
XmlNode imageNode = root.getChild(ImageTag);
if (imageNode.hasAttribute(ImageOrientationTag)) {
String value = imageNode.getAttribute(ImageOrientationTag);
try {
ImageOrientation oldOrientation =
ImageOrientation.getOrientationFor(Short.parseShort(value));
ImageOrientation newOrientation = meta.getOrientation();
if (oldOrientation != newOrientation) {
meta.setOrientation(oldOrientation);
}
}
catch (NumberFormatException e) {
throw new XMLException(
"Image orientation \"" + value + "\" is not a number", e
);
}
}
// Backwards compatibility: before XMP support, the convention in LZN
// files was that the image orientation was its original orientation,
// before any browser rotations.
else {
// Make sure this pre-XMP LZN structure is not a Template.
// (See Application.saveTemplate().)
if (! root.getName().equals("Template")) {
ImageOrientation origOrient = meta.getOriginalOrientation();
meta.setOrientation(origOrient);
}
}
engine = EngineFactory.createEngine(meta, versionInfo, thread);