B4A Library JpegUtils library gives access to Exif data

bluedude

Well-Known Member
Licensed User
That sounds awesome, could mean I can write GPS stuff to the images taken with the camera.
 

mkvidyashankar

Active Member
Licensed User
I am trying to save some description to jpg exif data. What is the tag to save description ?
 

praetor100

New Member
Hi agraham,

I'm also would like to save descriptions into jpg exif data. Please could you add this meta tag in your library?

Thank you and best regards
praetor
 

gadgetmonster

Active Member
Licensed User
Exif data always blank

Hi All

I'm having issues getting to the exif data using this library and could really do with some help please.

I use the contentchooser to allow the user to pic a photo from the camera. Once selected I end up in

B4X:
imageChooser_Result (Success As Boolean, Dir As String, FileName As String)
Which gives me the directory and filename. As a simple test I then do:

B4X:
exif.Initialize(Dir, FileName)
Dim temp As String
temp = exif.getAttribute(exif.TAG_DATETIME)
But temp is always blank. I don't get any exceptions either.

Any ideas?
 

gadgetmonster

Active Member
Licensed User
Just to add, I have copied the images from my device onto my PC to verify that exif data is present and it is. My camera images b y default are stored on my SD card so I have also copied them onto the device itself and still no joy.

When returning from the content chooser, Dir = ContentDir and the Filename = content://media/external/images/media/3425 which is odd as this is not the actual name of the jpg when viewing in windows. Could this be the problem and if so how to get the correct filename.

Thanks in advance :)
 
Last edited:

agraham

Expert
Licensed User
Run the JpegUtils demo and check that the date is shown in the message box that shows when you tap the picture. A blank date may be a sign that the filename or directory is not valid. For some reason the Android ExifInterface object, which this library wraps, does not throw an Exception when initialised with an non-existent file. The initialiser for ExifInterface takes a full path (Android is not very consistent with filenames and paths) which is done like this.
B4X:
exif = new ExifInterface(dir + "/" + filename);
Log your directory and filename and see what they look like.
 

swissmade

Well-Known Member
Licensed User
Copy Image to new resized Image with EXIF data

Hi all,

I wondering, if it is possible, to copy the old EXIF data to the new resized Image.
I have try this but then you must copy Tag for Tag.

Is there an other way to do this.

To explain this better
I take a Picture with my Camera save as "1.jpg"
Then I resize the Image to about 800x600
Save this Image as "2.jpg"
In "1.jpg" I still have the EXIF data and "2.jpg" has no EXIF data.

Many thanks for any help.:sign0163:
 

corvo

Member
Licensed User
Help whit lat and lon

Hi, i have some problem to extract gps coordinates from a jpeg, whit the command

dim test as string

test=exif.getAttribute(exif.TAG_GPS_LATITUDE_REF)
my string contain on a letter: "N", and if i use

dim test as string

test=exif.getAttribute(exif.TAG_GPS_LATITUDE)
my string is made by strange value, like 150/569.456/1452N

how i can take the coords whit your library?

:sign0104::sign0104:
 

corvo

Member
Licensed User
Thank you erel, this is the string
56/1,16973828/65539,393216/1795N

and i got also problem if i try to save the exif data in a string, i need a example :(:sign0104:
 

agraham

Expert
Licensed User
Here is the format of the GPS Exif tags.

TIFF Tag Reference, GPS Tags

By following the links you will see Latitude and Longitude are expressed as three rational numbers.

three RATIONAL values giving the degrees, minutes, and seconds, respectively. If latitude is expressed as degrees, minutes and seconds, a typical format would be dd/1,mm/1,ss/1. When degrees and minutes are used and, for example, fractions of minutes are given up to two decimal places, the format would be dd/1,mmmm/100,0/1.
 

corvo

Member
Licensed User
Thank you, but i need the value in grades ( fox example 38,5448521455895), how i can convert it? another question whit exif i tried to set the lat lon coordinates in a pic, but it don't works
Dim fname As String
fname = "bb.jpg"
exif.Initialize(File.DirRootExternal, fname)

exif.setAttribute(exif.TAG_GPS_LATITUDE,"78.4879874897979")
exif.setAttribute(exif.TAG_GPS_LONGITUDE,"25.62541525855")
exif.saveAttributes
whitout a clear example is very hard for me to undestand, cause i'm not a expert :( thenk you
 
Top