EXIF tag access using new Tasker-Action "Java function" -- Syntax problems??!

429 views
Skip to first unread message

ithaka ner

unread,
Jan 27, 2015, 1:51:36 PM1/27/15
to tas...@googlegroups.com
Hello Tasker-Community,
since I've read the Tasker's 4.6 changelog, I was eager to use the new Java Function in my projects.

Recently I needed an option to access the EXIF tags of jpg images, first try with JS was to complicated due to
file access and same-origin-issues.
So I decided to replicate the Java way by using the ExifInterface class (see Android Developers). This might be
also very interesting for other users, so I will publish a solution when working/ready upon request.

When I understood everything right, the actions below should text-flash the used ISO value (AD):
Java Exif Img
A1: Variable Set [ Name:%imgpath To:/sdcard/exifTest.jpg ]
A2: Java Function [ Return:(ExifInterface) ei Class Or Object:ExifInterface Function:new {ExifInterface} (String) Param:%imgpath
A3: Java Function [ Return:%exifvalue Class Or Object:ei Function:getAttribute {String} (String) Param:TAG_ISO]
A4: Flash [ Text:%exifvalue Long:On ]
Comments:
A1: define the targeted image as variable, I want to loop trough a directory later when it's working ;-)
A2: load the class "ExifInterface" and pass the absolute path as (String) and define all that as "ei" (=object??!)
A3: run "getAttribute" on "ei" with "TAG_ISO" as (String)-parameter and return the result as Tasker-Var: %exifvalue ({String}-variable)
A4: output of the result

But so far it's not working - I appreciate any help. Since I' always keen to lean new stuff, I'm also 
happy if someone can point me towards the stumble.


PS.: Due to the fact that I'm not so familiar with Java programming - another question for the Java||Tasker experts:
Is there a simple option to return a selection or all exif-tags, best as JSON either direct or saved to storage?
The later use of the EXIF-data would be in a WebView with JS for readout and processing.

David Wang

unread,
Jan 28, 2015, 8:39:34 PM1/28/15
to tas...@googlegroups.com
Use "ISOSpeedRatings" instead of "TAG_ISO". (In fact, "ISOSpeedRatings" is the value of "TAG_ISO".) 'Cause Tasker just couldn't get the value only from its name at present. 

Of course, you can also get the value of "TAG_ISO" programmmatically using the "reflection" feature of JAVA. See the example here for reference.

My xml file for "access exif tag in Java" also attached.
exifTagRead.tsk.xml

Wietse van Buitenen

unread,
Jan 29, 2015, 6:18:14 AM1/29/15
to tas...@googlegroups.com
This is great!
Thanks for posting this!

Now I discovered that I have some pictures without lat lon while they should have it..
I can use this to list and correct if needed :)

ithaka ner

unread,
Feb 5, 2015, 7:57:16 PM2/5/15
to tas...@googlegroups.com
Splendid David! Your example is working perfectly, I understood where my mistake was :)
I'll try now to dig through this mentioned JAVA "reflection" feature and expand the whole thing it to my needs...
Thanks a lot for this heading!

Jim Davidson

unread,
Feb 29, 2016, 12:38:44 PM2/29/16
to Tasker
Hello to all;

This is an older discussion but I'm hoping for some guidance. I'm moderately familiar with Tasker and have been trying to create a series of tasks that will read the EXIF info for a given jpeg file and return the make and model of the camera used in my photos.

I have followed the examples to the letter and I keep returning an empty %result variable. I have confirmed that EXIF info is in the image via online and PC-based EXIF reader programs.

I've tried the TAG_ISO, ISOSpeedRatings options as well to no avail.

I'm assuming that I use the MODEL or MAKE tags in the Param(String) but because I get no results from the other information (ISOSpeedRatings), I'm not certain if I'm doing something wrong.

I have a Galaxy Note4 running 5.1.1, Tasker 4.7u3m.

Thanks for any assistance anyone can provide.
Reply all
Reply to author
Forward
0 new messages