B4J Question How to read the EXIF metadata from an large jpg image with B4J?

js486dog

Active Member
Licensed User
Longtime User
I modified this code:

LOOK HERE

and I am attaching a program that reads latitude and longitude from a jpg file.
jar file for Libraries folder is attached.

Everything seems to be fine as long as the 360 degree jpg file is small (164 kb).
But the problem arises if the 360 degree jpg file is large (14 MB).
Could someone please advise me how to modify the code to read metadata from a large jpg file as well?
Or is there any other way to read the EXIF metadata (latitude, longitude ...) with B4J?
 

Attachments

  • InlineJava new.zip
    357 KB · Views: 23

js486dog

Active Member
Licensed User
Longtime User
1. What happens with the large file?

2. It will probably behave the same, but please try it with the code I posted in that thread.

Erel, please look at the attached pictures and the ERROR report:


WARNING: package com.sun.javafx.embed.swing.oldimpl not in javafx.swing
Waiting for debugger to connect...
Program started.
Error occurred on line: 30 (Main)
java.lang.reflect.InvocationTargetException
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4j.object.JavaObject.RunMethod(JavaObject.java:132)
at b4j.example.main._appstart(main.java:104)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.shell.Shell.runMethod(Shell.java:629)
at anywheresoftware.b4a.shell.Shell.raiseEventImpl(Shell.java:237)
at anywheresoftware.b4a.shell.Shell.raiseEvent(Shell.java:167)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:564)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:111)
at anywheresoftware.b4a.shell.ShellBA.raiseEvent2(ShellBA.java:100)
at anywheresoftware.b4a.BA.raiseEvent(BA.java:98)
at b4j.example.main.start(main.java:43)
at javafx.graphics/com.sun.javafx.application.LauncherImpl.lambda$launchApplication1$9(LauncherImpl.java:846)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runAndWait$12(PlatformImpl.java:455)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$10(PlatformImpl.java:428)
at java.base/java.security.AccessController.doPrivileged(AccessController.java:391)
at javafx.graphics/com.sun.javafx.application.PlatformImpl.lambda$runLater$11(PlatformImpl.java:427)
at javafx.graphics/com.sun.glass.ui.InvokeLaterDispatcher$Future.run(InvokeLaterDispatcher.java:96)
at javafx.graphics/com.sun.glass.ui.win.WinApplication._runLoop(Native Method)
at javafx.graphics/com.sun.glass.ui.win.WinApplication.lambda$runLoop$3(WinApplication.java:174)
at java.base/java.lang.Thread.run(Thread.java:832)
Caused by: java.lang.NoClassDefFoundError: com/adobe/xmp/XMPException
at com.drew.imaging.jpeg.JpegMetadataReader.extractMetadataFromJpegSegmentReader(JpegMetadataReader.java:112)
at com.drew.imaging.jpeg.JpegMetadataReader.readMetadata(JpegMetadataReader.java:71)
at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:108)
at com.drew.imaging.ImageMetadataReader.readMetadata(ImageMetadataReader.java:95)
at b4j.example.main.GetImgMeta(main.java:201)
... 30 more
Caused by: java.lang.ClassNotFoundException: com.adobe.xmp.XMPException
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:602)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:178)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
... 35 more
 

Attachments

  • large image is ERROR.jpg
    large image is ERROR.jpg
    445.4 KB · Views: 21
  • small image is OK.jpg
    small image is OK.jpg
    110.9 KB · Views: 19
Upvote 0

Daestrum

Expert
Licensed User
Longtime User
Looks like you are missing the xmpcore-x.x.xx.jar which contains the missing class (the x in the name is the version etc, get the latest one that works).
 
Upvote 0

js486dog

Active Member
Licensed User
Longtime User
Looks like you are missing the xmpcore-x.x.xx.jar which contains the missing class (the x in the name is the version etc, get the latest one that works).


Thank you very much "Daestrum" now works fine with xmpcore-5.1.2.
Do not work with xmpcore-6.1.11.
 

Attachments

  • large image is OK.jpg
    large image is OK.jpg
    112.6 KB · Views: 16
Upvote 0
Solution
Top