com.drew.metadata.Directory.getInt()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.2k)|赞(0)|评价(0)|浏览(170)

本文整理了Java中com.drew.metadata.Directory.getInt()方法的一些代码示例,展示了Directory.getInt()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Directory.getInt()方法的具体详情如下:
包路径:com.drew.metadata.Directory
类名称:Directory
方法名:getInt

Directory.getInt介绍

[英]Returns the specified tag's value as an int, if possible. Every attempt to represent the tag's value as an int is taken. Here is a list of the action taken depending upon the tag's original type:

  • int - Return unchanged.
  • Number - Return an int value (real numbers are truncated).
  • Rational - Truncate any fractional part and returns remaining int.
  • String - Attempt to parse string as an int. If this fails, convert the char[] to an int (using shifts and OR).
  • Rational[] - Return int value of first item in array.
  • byte[] - Return int value of first item in array.
  • int[] - Return int value of first item in array.
    [中]如果可能,以int形式返回指定标记的值。每次尝试将标记的值表示为int时都会执行。以下是根据标记的原始类型采取的操作列表:
    *int-返回不变。
    *Number-返回一个int值(实数被截断)。
    *Rational-截断任何小数部分并返回剩余的整数。
    *String—尝试将字符串解析为int。如果失败,请将char[]转换为int(使用移位和或)。
    *Rational[]-返回数组中第一项的int值。
    *字节[]-返回数组中第一项的int值。
    *int[]-返回数组中第一项的int值。

代码示例

代码示例来源:origin: stackoverflow.com

orientation = directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
} catch (MetadataException me) {
  logger.warn("Could not get orientation");

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setBitPerPixel(Directory directory, int tagType1, int tagType2) {
 try {
  setBitPerPixel(directory.getInt(tagType1) * directory.getInt(tagType2));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setAudioSampleSize(Directory directory, int tagType) {
 try {
  setAudioSampleSize(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setPixelWidth(Directory directory, int tagType) {
 try {
  setPixelWidth(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setPixelHeight(Directory directory, int tagType) {
 try {
  setPixelHeight(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setDPIWidth(Directory directory, int tagType, double factor) {
 try {
  setDPIWidth(directory.getInt(tagType) * factor);
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setDPIHeight(Directory directory, int tagType, double factor) {
 try {
  setDPIHeight(directory.getInt(tagType) * factor);
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setOrientation(Directory directory, int tagType) {
 try {
  setOrientation(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setDPIWidth(Directory directory, int tagType) {
 try {
  setDPIWidth(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setDPIHeight(Directory directory, int tagType) {
 try {
  setDPIHeight(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: org.apache.drill.exec/drill-java-exec

public void setBitPerPixel(Directory directory, int tagType) {
 try {
  setBitPerPixel(directory.getInt(tagType));
 } catch (MetadataException e) {
  // Nothing needs to be done
 }
}

代码示例来源:origin: torakiki/sejda

private static int readExifOrientation(Metadata metadata) throws MetadataException {
  Directory directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
  return directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
}

代码示例来源:origin: org.sejda/sejda-sambox

private static int readExifOrientation(Metadata metadata) throws MetadataException {
  Directory directory = metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
  return directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
}

代码示例来源:origin: fluxtream/fluxtream-app

/**
 * Tries to read the orientation data from the given image {@link Metadata}.  Returns <code>null</code> if not
 * found or if an error occurs.
 */
@Nullable
public static ImageOrientation getOrientation(@Nullable final Metadata metadata) {
  if (metadata != null) {
    final Directory exifIfd0Directory = metadata.getDirectory(ExifIFD0Directory.class);
    if (exifIfd0Directory != null) {
      try {
        return findById(exifIfd0Directory.getInt(ExifIFD0Directory.TAG_ORIENTATION));
      }
      catch (Exception e) {
        LOG.info("ImageOrientation.getOrientation(): Exception while trying to read the orientation data from the EXIF.  Ignoring and just returning null");
      }
    }
  }
  return null;
}

代码示例来源:origin: xautlx/s2jh4net

int orientation = directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);

代码示例来源:origin: stackoverflow.com

Metadata header;
try {
  ByteArrayInputStream bais= new ByteArrayInputStream(data);
  ExifReader reader = new ExifReader(bais);
  header = reader.extract();
  Directory dir = header.getDirectory(ExifDirectory.class);
  if (dir.containsTag(ExifDirectory.TAG_ORIENTATION)) {
    Log.v(TAG, "tag_orientation exists: " + dir.getInt(ExifDirectory.TAG_ORIENTATION));
  }
  else {
    Log.v(TAG, "tag_orietation doesn't exist");
  }

} catch (JpegProcessingException e) {
  // TODO Auto-generated catch block
  e.printStackTrace();
} catch (MetadataException e) {
  e.printStackTrace();
}

代码示例来源:origin: stackoverflow.com

orientation = directory.getInt(ExifIFD0Directory.TAG_ORIENTATION);
} catch (MetadataException me) {
System.out.println("Could not get orientation");

相关文章