Skip to content

Instantly share code, notes, and snippets.

@taka2
Created November 10, 2009 13:14
Show Gist options
  • Select an option

  • Save taka2/230881 to your computer and use it in GitHub Desktop.

Select an option

Save taka2/230881 to your computer and use it in GitHub Desktop.
import java.io.File;
// metadata extraction in java: http://www.drewnoakes.com/code/exif/
import com.drew.imaging.jpeg.*;
import com.drew.metadata.*;
import com.drew.metadata.exif.*;
public class JavaTest
{
public static void main(String[] args) throws Exception
{
// ファイルの取得
File f = new File("IMG_0665.JPG");
// JPEGメタデータの取得
Metadata metadata = JpegMetadataReader.readMetadata(f);
// 撮影日を取得して表示
System.out.println("撮影日(Date/Time Original) = " + metadata.getDirectory(ExifDirectory.class).getString(ExifDirectory.TAG_DATETIME_ORIGINAL));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment