/************************************************************************** /* This class dumps image meta-information. /* /* Copyright (c) 2006 by Bernhard Bablok (mail@bablokb.de) /* /* This program is free software; you can redistribute it and/or modify /* it under the terms of the GNU General Public License as published /* by the Free Software Foundation; either version 2 of the License or /* (at your option) any later version. /* /* This program is distributed in the hope that it will be useful, but /* WITHOUT ANY WARRANTY; without even the implied warranty of /* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the /* GNU General Public License for more details. /* /* You should have received a copy of the GNU General Public License /* along with this program; see the file COPYING. If not, write to /* the Free Software Foundation Inc., 59 Temple Place - Suite 330, /* Boston, MA 02111-1307 USA /**************************************************************************/ import java.io.*; import java.util.*; import com.drew.imaging.jpeg.*; import com.drew.metadata.*; /** This class dumps image meta-information. @version $Revision: 1.1 $ @author $Author: bablokb $ */ public class PrintMeta2 extends PrintMeta { ////////////////////////////////////////////////////////////////////////////// /** Constructor. */ public PrintMeta2() { } ////////////////////////////////////////////////////////////////////////////// /** Dump meta-data of a file to standard output. */ public void dump(File f) throws Exception { Metadata metadata = JpegMetadataReader.readMetadata(f); Iterator directories = metadata.getDirectoryIterator(); while (directories.hasNext()) { Directory directory = (Directory)directories.next(); Iterator tags = directory.getTagIterator(); while (tags.hasNext()) { Tag tag = (Tag) tags.next(); System.out.println(tag); } } } ////////////////////////////////////////////////////////////////////////////// /** Main method. Pass files as arguments. */ public static void main(String[] args) { if (args.length < 1) { System.out.println("usage: java " + PrintMeta2.class.getName() + " file [...]"); System.exit(3); } try { PrintMeta2 printer = new PrintMeta2(); printer.processImages(args); } catch (Exception e) { e.printStackTrace(); } } }