Last change
on this file since 99 was 99, checked in by imi, 18 years ago |
- added GeoImage feature (showing images on a tracklog)
- added zoom slider
- added Escape cancels selection rectangle
- added "Save password" option to Auth-dialog
- fixed that redo/undo buttons were not enabled
- fixed hotkeys beeing inaccessible when no data is loaded
|
File size:
1.1 KB
|
Line | |
---|
1 | package org.openstreetmap.josm.tools;
|
---|
2 |
|
---|
3 | import java.io.File;
|
---|
4 | import java.text.SimpleDateFormat;
|
---|
5 | import java.util.Date;
|
---|
6 | import java.util.Iterator;
|
---|
7 |
|
---|
8 | import com.drew.imaging.jpeg.JpegMetadataReader;
|
---|
9 | import com.drew.metadata.Directory;
|
---|
10 | import com.drew.metadata.Metadata;
|
---|
11 | import com.drew.metadata.Tag;
|
---|
12 |
|
---|
13 | /**
|
---|
14 | * Read out exif file information from a jpeg file
|
---|
15 | * @author Imi
|
---|
16 | */
|
---|
17 | public class ExifReader {
|
---|
18 |
|
---|
19 | @SuppressWarnings("unchecked") public static Date readTime(File filename) {
|
---|
20 | try {
|
---|
21 | Metadata metadata = JpegMetadataReader.readMetadata(filename);
|
---|
22 | for (Iterator<Directory> dirIt = metadata.getDirectoryIterator(); dirIt.hasNext();) {
|
---|
23 | for (Iterator<Tag> tagIt = dirIt.next().getTagIterator(); tagIt.hasNext();) {
|
---|
24 | Tag tag = tagIt.next();
|
---|
25 | if (tag.getTagType() == 0x132 || tag.getTagType() == 0x9003 || tag.getTagType() == 0x9004)
|
---|
26 | return new SimpleDateFormat("yyyy:MM:dd HH:mm:ss").parse(tag.getDescription());
|
---|
27 | }
|
---|
28 | }
|
---|
29 | } catch (Exception e) {
|
---|
30 | e.printStackTrace();
|
---|
31 | }
|
---|
32 | return null;
|
---|
33 | }
|
---|
34 | }
|
---|
Note:
See
TracBrowser
for help on using the repository browser.