本文整理汇总了Java中org.apache.sanselan.formats.tiff.constants.ExifTagConstants类的典型用法代码示例。如果您正苦于以下问题:Java ExifTagConstants类的具体用法?Java ExifTagConstants怎么用?Java ExifTagConstants使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ExifTagConstants类属于org.apache.sanselan.formats.tiff.constants包,在下文中一共展示了ExifTagConstants类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getExifExposureProgram
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
public static String getExifExposureProgram(Integer exposureProgramValue) {
if (exposureProgramValue == null || exposureProgramValue == 0) {
// not defined or unknown
return null;
}
switch (exposureProgramValue) {
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_PROGRAM_AE:
return "Normal Program";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_APERTURE_PRIORITY_AE:
return "Aperture priority";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_SHUTTER_SPEED_PRIORITY_AE:
return "Shutter priority";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_CREATIVE_SLOW_SPEED:
return "Creative program";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_ACTION_HIGH_SPEED:
return "Action program";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_PORTRAIT:
return "Portrait mode";
case ExifTagConstants.EXPOSURE_PROGRAM_VALUE_LANDSCAPE:
return "Landscape mode";
default:
// not defined or unknown
return null;
}
}
示例2: cameraMake
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
/**
* expects jpg file
* @param file
* @return String containing make of camera used to take jpg.
*/
private Map cameraMake(File file){
TiffField make = null;
HashMap<String,String> metaDataMap = new HashMap<>();
try {
IImageMetadata metadata = Sanselan.getMetadata(file);
if(metadata != null){
for(Object x : metadata.getItems()){
String xString = x.toString();
String[] arr = xString.split(": ");
// make, model, time, location, Software
if(arr[0].contains("Software") ||
arr[0].toUpperCase().equals("MODEL") ||
arr[0].toUpperCase().equals("MAKE") ||
arr[0].toUpperCase().contains("CREATE DATE")){
metaDataMap.put(arr[0], arr[1]);
}
}
if (metadata instanceof JpegImageMetadata) {
make = ((JpegImageMetadata) metadata).findEXIFValue(ExifTagConstants.EXIF_TAG_MAKE);
((JpegImageMetadata) metadata).dump();
}
}
} catch (Exception e) {
e.printStackTrace();
}
return metaDataMap;
}
示例3: displayMetaData
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
private void displayMetaData(File file){
try {
IImageMetadata metadata = Sanselan.getMetadata(file);
if (metadata instanceof JpegImageMetadata) {
TiffImageMetadata exif = null;
TiffOutputSet outputSet = null;
TiffField dateTimeValue = ((JpegImageMetadata) metadata).findEXIFValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
TiffField model = ((JpegImageMetadata) metadata).findEXIFValue(ExifTagConstants.EXIF_TAG_LOCALIZED_CAMERA_MODEL);
TiffField make = ((JpegImageMetadata) metadata).findEXIFValue(ExifTagConstants.EXIF_TAG_MAKE);
((JpegImageMetadata) metadata).dump();
if(make != null){
System.out.println(make);
}
if(model != null){
String s = model.getStringValue();
// System.out.println(s + " SHOULD BE THE MODEL");
}
IImageMetadata metadata2 = Sanselan.getMetadata(file);
JpegImageMetadata jpegMetadata = (JpegImageMetadata) metadata2;
if (jpegMetadata != null) {
exif = jpegMetadata.getExif();
if (exif != null) {
outputSet = exif.getOutputSet();
//System.out.println(exif);
}
}
} else {
System.out.println("Looks like metadata was not instanceof");
}
} catch (Exception e) {
System.out.println("some kind of error about could not get metadata from ");
e.printStackTrace();
}
}
示例4: getShootingTime
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
public static Optional<LocalDateTime> getShootingTime(File image) {
try {
IImageMetadata metadata = Sanselan.getMetadata(image);
if (metadata instanceof JpegImageMetadata) {
TiffField dateTimeValue = ((JpegImageMetadata) metadata)
.findEXIFValue(ExifTagConstants.EXIF_TAG_DATE_TIME_ORIGINAL);
if (dateTimeValue != null) {
String stringValue = dateTimeValue.getStringValue().trim();
String dateString = stringValue.split(" ")[0];
String timeString = stringValue.split(" ")[1];
String[] dateParts = dateString.split(":");
String[] timeParts = timeString.split(":");
LocalDate localDate = LocalDate.of(
Integer.valueOf(dateParts[0]),
Integer.valueOf(dateParts[1]),
Integer.valueOf(dateParts[2]));
LocalTime localTime = LocalTime.of(
Integer.valueOf(timeParts[0]),
Integer.valueOf(timeParts[1]),
Integer.valueOf(timeParts[2]));
return Optional.of(LocalDateTime.of(localDate, localTime));
}
}
} catch (Exception e) {
logger.error("Could not get metdata from {}", image, e);
}
return Optional.empty();
}
示例5: getExifFlash
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
public static Flash getExifFlash(Integer flashValue) {
Flash flash;
/* strobe counts as flash here, can differenciate if needed. */
if (null == flashValue) {
flash = Flash.NOT_FIRED;
} else if (flashValue == ExifTagConstants.FLASH_VALUE_FIRED
|| flashValue == ExifTagConstants.FLASH_VALUE_FIRED_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_FIRED_RETURN_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_ON
|| flashValue == ExifTagConstants.FLASH_VALUE_ON_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_ON_RETURN_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED_RETURN_DETECTED)
{
flash = Flash.FIRED;
} else if (flashValue == ExifTagConstants.FLASH_VALUE_FIRED_RED_EYE_REDUCTION
|| flashValue == ExifTagConstants.FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_AUTO_FIRED_RED_EYE_REDUCTION_RETURN_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_ON_RED_EYE_REDUCTION
|| flashValue == ExifTagConstants.FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_NOT_DETECTED
|| flashValue == ExifTagConstants.FLASH_VALUE_ON_RED_EYE_REDUCTION_RETURN_DETECTED)
{
flash = Flash.FIRED_WITH_RED_EYES_REDUCTION;
} else {
flash = Flash.NOT_FIRED;
}
return flash;
}
示例6: getExifColorSpace
import org.apache.sanselan.formats.tiff.constants.ExifTagConstants; //导入依赖的package包/类
public static String getExifColorSpace(Integer colorSpaceValue) {
if (colorSpaceValue == null) {
return null;
}
switch (colorSpaceValue) {
case ExifTagConstants.COLOR_SPACE_VALUE_ADOBE_RGB:
return "Adobe RGB";
default:
return "sRGB";
}
}