Saving EXIF information (orientation, geotagging, etc)

250 views
Skip to first unread message

Ping Flood

unread,
Feb 10, 2015, 9:21:08 AM2/10/15
to tas...@googlegroups.com
Hi dear firends, new user here in the group.

I'm trying manipulate EXIF tags in pictures taken using the Take Photo action.

I'm trying to use the Java ExifInterface to write a tag. (Reading seems to be working fine)

Attached follows the task I'm testing here (using the same tag ISOSpeedRatings used on David's post).

1. It does the following:
2. Take a photo
3. Creates a new instance of ExifInterface loading latest photo (%FOTO)
4. Set a new EXIF attribute using ei.setAttribute
5. Try to save the attribute to %FOTO using ei.saveAttributes.

6. Then, just to test if the tag was written:
7. Create another instance of ExifInterface loading %FOTO
8. Try to read the ISOSpeedRatings tag using ei.getAttribute and set %RES
9. Flash on screen the value of %FOTO and %RES

What was expecting the ISOSpeedRatings was written to %FOTO file, but this is not the case. The %FOTO remains unchanged and %RES is empty after reading.

I really wish we could work on exif data of pictures taken using Tasker. This way we could set by ourselves rotation, latitude, longitude, etc., not depending on built in Tasker functions.

Anyone have an idea? Any way to write EXIF data to file directly on Tasker and not depend on external apps/shell scripts?
If not, can we expect new parameters to Take Picture action anytime soon? All problems related to this could be managed if we have option to add a list of custom EXIF tags directly on Take Picture config..

With kind regards

SnapshotExifTagWrite.tsk.xml

David Wang

unread,
Feb 10, 2015, 10:45:45 AM2/10/15
to tas...@googlegroups.com
%FOTO may be a relative path.
The input parameters of "new
{ExifInterface} (String)" need file full path.

Try to use following action to get mount point of your SD card first. Then use "%MNT/%FOTO" as input parameters instead of "%FOTO".
A1: Java Function [ Return:%MNT_SD Class Or Object:Environment Function:getExternalStorageDirectory
{File} () Param: Param: Param: Param: Param: Param: Param: Continue Task After Error:On ]

I had test it. It's OK now. :-)

Ping Flood

unread,
Feb 10, 2015, 11:05:41 AM2/10/15
to tas...@googlegroups.com
Fantastic, David!

Sorry if it was a dumb question... I just bought Tasker in about two weeks. ;)
I thought the problem was on Java side, but it was my mistake not having noted the %FOTO characteristic you pointed out.

All working fine now.

As soon as I finish my task to geotag photos I'll share here to our peers review, improve and use.

Thank you.

With kind regards

Ping Flood

unread,
Feb 10, 2015, 12:28:24 PM2/10/15
to tas...@googlegroups.com
Hey guys.. Ok, here it is..

It's just the first version, with only the basic geotagging information.

It consists in three tasks.

The EXIFdecToDMS is a task/function that receives as argument lat or lon in decimal format (12.34567) and returns the DMS expected by EXIF specs (12/1,20/1,444/10).
It is used inside the EXIFsaveGeoTag task.

The EXIFsaveGeoTag is a task/function that receives a file path as argument. It will read the %LOC variable, split, check N-S/E-W, pass lat/lon to EXIFdecToDMS and use ExifInterface to write GPSLatitude, GPSLatitudeRef, GPSLongitude, GPSLongitudeRef to the file received as argument.

The GeotaggedPicture task will define the %mnt var, take a photo and pass %mnt/%FOTO to EXIFsaveGeoTag.

In this example I'm using it to take a picture and geotag, but since EXIFsaveGeoTag receive a file path as argument, you can mess with it as you want.


If you use this tasks and the coordinates aren't correct, start checking inside EXIFdecToDMS the return value. Maybe you'll need to play with the fraction of seconds (%sss/10, %sss/100, %sss/1000, etc).


I tested it using a Moto G and /10 is the correct value for my setup.


Hope it can be useful for someone.

And thanks again for the kind advice gave by David Wang.

--
Best regards
EXIFdecToDMS.tsk.xml
EXIFsaveGeoTag.tsk.xml
GeotaggedPicture.tsk.xml
Reply all
Reply to author
Forward
0 new messages