当前位置: 首页>>代码示例>>Java>>正文


Java ExifTagConstants类代码示例

本文整理汇总了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;
    }
}
 
开发者ID:imCodePartnerAB,项目名称:imcms,代码行数:27,代码来源:ExifUtils.java

示例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;
}
 
开发者ID:mcgyver5,项目名称:mngoat,代码行数:36,代码来源:PicturesServlet.java

示例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();
	}
	 
}
 
开发者ID:mcgyver5,项目名称:mngoat,代码行数:41,代码来源:RetrievePicture.java

示例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();
}
 
开发者ID:shaolinwu,项目名称:uimaster,代码行数:33,代码来源:ImageUtil.java

示例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;
}
 
开发者ID:imCodePartnerAB,项目名称:imcms,代码行数:35,代码来源:ExifUtils.java

示例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";
    }
}
 
开发者ID:imCodePartnerAB,项目名称:imcms,代码行数:13,代码来源:ExifUtils.java


注:本文中的org.apache.sanselan.formats.tiff.constants.ExifTagConstants类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。