Package com.drew.metadata

Examples of com.drew.metadata.Metadata


          break;
        }
      }
      dis.reset();
      MetadataReader reader = new MetadataReader(dis);
      Metadata metadata = reader.extract();
      Iterator directories = metadata.getDirectoryIterator();
      while (directories.hasNext()) {
        Directory directory = (Directory)directories.next();
        Iterator tags = directory.getTagIterator();
        while (tags.hasNext()) {
          Tag tag = (Tag)tags.next();
View Full Code Here


  public JsonObject updateImageData(Image image) throws IOException, ImageProcessingException {
    JsonObject imgData = new JsonObject();

    if (image != null) {
      File imageFile = new File(cfg.getImageRootPath() + image.getDirectory().getPath() + "\\\\" + image.getName());
      Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
      // Un-comment to reverse engineer EXIF data structure
      //      for (com.drew.metadata.Directory directory: metadata.getDirectories()) {
      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
View Full Code Here

   * @throws IOException
   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
View Full Code Here

   * @throws IOException
   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
View Full Code Here

  public JsonObject updateImageData(Image image) throws IOException, ImageProcessingException {
    JsonObject imgData = new JsonObject();

    if (image != null) {
      File imageFile = new File(cfg.getImageRootPath() + image.getDirectory().getPath() + "\\\\" + image.getName());
      Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
      // Un-comment to reverse engineer EXIF data structure (do not erase)
      //      for (com.drew.metadata.Directory directory: metadata.getDirectories()) {
      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
View Full Code Here

  public JsonObject updateImageData(Image image) throws IOException, ImageProcessingException {
    JsonObject imgData = new JsonObject();

    if (image != null) {
      File imageFile = new File(cfg.getImageRootPath() + image.getDirectory().getPath() + "\\\\" + image.getName());
      Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
      // Un-comment to reverse engineer EXIF data structure (do not erase)
      //      for (com.drew.metadata.Directory directory: metadata.getDirectories()) {
      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
View Full Code Here

   * @throws IOException
   * @throws ImageProcessingException
   */
  protected java.sql.Date getImgDate(File img, java.sql.Date defaultDate) throws IOException, ImageProcessingException {
    Date imgDate = null;
    Metadata metadata = ImageMetadataReader.readMetadata(img);
    ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
    try {
      // Try to find a date in image EXIF data,...
      if (exifDir != null) {
        imgDate = exifDir.getDate(ExifSubIFDDirectory.TAG_DATETIME_ORIGINAL);
        if (imgDate == null) {
View Full Code Here

  public JsonObject updateImageData(Image image) throws IOException, ImageProcessingException {
    JsonObject imgData = new JsonObject();

    if (image != null) {
      File imageFile = new File(cfg.getImageRootPath() + image.getDirectory().getPath() + "\\\\" + image.getName());
      Metadata metadata = ImageMetadataReader.readMetadata(imageFile);
      // Un-comment to reverse engineer EXIF data structure
      //      for (com.drew.metadata.Directory directory: metadata.getDirectories()) {
      //        for (Tag tag : directory.getTags()) {
      //          cfg.getCtxt().log("" + tag);
      //        }
      //      }
      // retrieve jpeg tags if any
      JpegDirectory jpegDir = metadata.getDirectory(JpegDirectory.class);
      ExifSubIFDDirectory exifDir = metadata.getDirectory(ExifSubIFDDirectory.class);
      try {
        imgData.addParameter(Configuration.heigthParam, jpegDir.getImageHeight());
        imgData.addParameter(Configuration.widthParam, jpegDir.getImageWidth());
      }
      catch (MetadataException ex1) {
View Full Code Here

    );

    @NotNull
    public static Metadata readMetadata(@NotNull InputStream inputStream, @Nullable Iterable<JpegSegmentMetadataReader> readers) throws JpegProcessingException, IOException
    {
        Metadata metadata = new Metadata();
        process(metadata, inputStream, readers);
        return metadata;
    }
View Full Code Here

public class PsdMetadataReader
{
    @NotNull
    public static Metadata readMetadata(@NotNull File file) throws IOException
    {
        Metadata metadata = new Metadata();

        RandomAccessFile randomAccessFile = new RandomAccessFile(file, "r");

        try {
            new PsdReader().extract(new RandomAccessFileReader(randomAccessFile), metadata);
View Full Code Here

TOP

Related Classes of com.drew.metadata.Metadata

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.