public JsonObject updateImageData(Image image) throws IOException, ImageProcessingException {
JsonObject imgData = new JsonObject();
if (image != null) {
File imageFile = new File(cfg.getImageRootPath() + image.getDirectory().getPath() + "\\\\" + image.getName());
Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
// Un-comment to reverse engineer EXIF data structure (do not erase)
// for (com.drew.metadata.Directory directory: metadata.getDirectories()) {
// for (Tag tag : directory.getTags()) {
// cfg.getCtxt().log("" + tag);
// }
// }
// retrieve jpeg tags if any
JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
try {
imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
}
catch (MetadataException ex1) {