📄 exifdescriptor.java
字号:
case 6: return "Program action (high-speed program)";
case 7: return "Portrait mode";
case 8: return "Landscape mode";
default:
return "Unknown program (" + _directory.getInt(ExifDirectory.TAG_EXPOSURE_PROGRAM) + ")";
}
}
public String getYCbCrSubsamplingDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_YCBCR_SUBSAMPLING)) return null;
int[] positions = _directory.getIntArray(ExifDirectory.TAG_YCBCR_SUBSAMPLING);
if (positions[0] == 2 && positions[1] == 1) {
return "YCbCr4:2:2";
} else if (positions[0] == 2 && positions[1] == 2) {
return "YCbCr4:2:0";
} else {
return "(Unknown)";
}
}
public String getPlanarConfigurationDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_PLANAR_CONFIGURATION)) return null;
// When image format is no compression YCbCr, this value shows byte aligns of YCbCr
// data. If value is '1', Y/Cb/Cr value is chunky format, contiguous for each subsampling
// pixel. If value is '2', Y/Cb/Cr value is separated and stored to Y plane/Cb plane/Cr
// plane format.
switch (_directory.getInt(ExifDirectory.TAG_PLANAR_CONFIGURATION)) {
case 1: return "Chunky (contiguous for each subsampling pixel)";
case 2: return "Separate (Y-plane/Cb-plane/Cr-plane format)";
default:
return "Unknown configuration";
}
}
public String getSamplesPerPixelDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_SAMPLES_PER_PIXEL)) return null;
return _directory.getString(ExifDirectory.TAG_SAMPLES_PER_PIXEL) + " samples/pixel";
}
public String getRowsPerStripDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_ROWS_PER_STRIP)) return null;
return _directory.getString(ExifDirectory.TAG_ROWS_PER_STRIP) + " rows/strip";
}
public String getStripByteCountsDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_STRIP_BYTE_COUNTS)) return null;
return _directory.getString(ExifDirectory.TAG_STRIP_BYTE_COUNTS) + " bytes";
}
public String getPhotometricInterpretationDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_PHOTOMETRIC_INTERPRETATION)) return null;
// Shows the color space of the image data components
switch (_directory.getInt(ExifDirectory.TAG_PHOTOMETRIC_INTERPRETATION)) {
case 0: return "WhiteIsZero";
case 1: return "BlackIsZero";
case 2: return "RGB";
case 3: return "RGB Palette";
case 4: return "Transparency Mask";
case 5: return "CMYK";
case 6: return "YCbCr";
case 8: return "CIELab";
case 9: return "ICCLab";
case 10: return "ITULab";
case 32803: return "Color Filter Array";
case 32844: return "Pixar LogL";
case 32845: return "Pixar LogLuv";
case 32892: return "Linear Raw";
default:
return "Unknown colour space";
}
}
public String getCompressionDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_COMPRESSION)) return null;
switch (_directory.getInt(ExifDirectory.TAG_COMPRESSION)) {
case 1: return "Uncompressed";
case 2: return "CCITT 1D";
case 3: return "T4/Group 3 Fax";
case 4: return "T6/Group 4 Fax";
case 5: return "LZW";
case 6: return "JPEG (old-style)";
case 7: return "JPEG";
case 8: return "Adobe Deflate";
case 9: return "JBIG B&W";
case 10: return "JBIG Color";
case 32766: return "Next";
case 32771: return "CCIRLEW";
case 32773: return "PackBits";
case 32809: return "Thunderscan";
case 32895: return "IT8CTPAD";
case 32896: return "IT8LW";
case 32897: return "IT8MP";
case 32898: return "IT8BL";
case 32908: return "PixarFilm";
case 32909: return "PixarLog";
case 32946: return "Deflate";
case 32947: return "DCS";
case 32661: return "JBIG";
case 32676: return "SGILog";
case 32677: return "SGILog24";
case 32712: return "JPEG 2000";
case 32713: return "Nikon NEF Compressed";
default:
return "Unknown compression";
}
}
public String getBitsPerSampleDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_BITS_PER_SAMPLE)) return null;
return _directory.getString(ExifDirectory.TAG_BITS_PER_SAMPLE) + " bits/component/pixel";
}
public String getThumbnailImageWidthDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_THUMBNAIL_IMAGE_WIDTH)) return null;
return _directory.getString(ExifDirectory.TAG_THUMBNAIL_IMAGE_WIDTH) + " pixels";
}
public String getThumbnailImageHeightDescription()
{
if (!_directory.containsTag(ExifDirectory.TAG_THUMBNAIL_IMAGE_HEIGHT)) return null;
return _directory.getString(ExifDirectory.TAG_THUMBNAIL_IMAGE_HEIGHT) + " pixels";
}
public String getFocalPlaneXResolutionDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_FOCAL_PLANE_X_RES)) return null;
Rational rational = _directory.getRational(ExifDirectory.TAG_FOCAL_PLANE_X_RES);
return rational.getReciprocal().toSimpleString(_allowDecimalRepresentationOfRationals) + " " +
getFocalPlaneResolutionUnitDescription().toLowerCase();
}
public String getFocalPlaneYResolutionDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_FOCAL_PLANE_Y_RES)) return null;
Rational rational = _directory.getRational(ExifDirectory.TAG_FOCAL_PLANE_Y_RES);
return rational.getReciprocal().toSimpleString(_allowDecimalRepresentationOfRationals) + " " +
getFocalPlaneResolutionUnitDescription().toLowerCase();
}
public String getFocalPlaneResolutionUnitDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_FOCAL_PLANE_UNIT)) return null;
// Unit of FocalPlaneXResoluton/FocalPlaneYResolution. '1' means no-unit,
// '2' inch, '3' centimeter.
switch (_directory.getInt(ExifDirectory.TAG_FOCAL_PLANE_UNIT)) {
case 1:
return "(No unit)";
case 2:
return "Inches";
case 3:
return "cm";
default:
return "";
}
}
public String getExifImageWidthDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_EXIF_IMAGE_WIDTH)) return null;
return _directory.getInt(ExifDirectory.TAG_EXIF_IMAGE_WIDTH) + " pixels";
}
public String getExifImageHeightDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_EXIF_IMAGE_HEIGHT)) return null;
return _directory.getInt(ExifDirectory.TAG_EXIF_IMAGE_HEIGHT) + " pixels";
}
public String getColorSpaceDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_COLOR_SPACE)) return null;
int colorSpace = _directory.getInt(ExifDirectory.TAG_COLOR_SPACE);
if (colorSpace == 1) {
return "sRGB";
} else if (colorSpace == 65535) {
return "Undefined";
} else {
return "Unknown";
}
}
public String getFocalLengthDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_FOCAL_LENGTH)) return null;
java.text.DecimalFormat formatter = new DecimalFormat("0.0##");
Rational focalLength = _directory.getRational(ExifDirectory.TAG_FOCAL_LENGTH);
return formatter.format(focalLength.doubleValue()) + " mm";
}
public String getFlashDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_FLASH)) return null;
/*
* This is a bitmask.
* 0 = flash fired
* 1 = return detected
* 2 = return able to be detected
* 3 = unknown
* 4 = auto used
* 5 = unknown
* 6 = red eye reduction used
*/
int val = _directory.getInt(ExifDirectory.TAG_FLASH);
StringBuffer sb = new StringBuffer();
if ((val & 0x1)!=0)
sb.append("Flash fired");
else
sb.append("Flash did not fire");
// check if we're able to detect a return, before we mention it
if ((val & 0x4)!=0)
{
if ((val & 0x2)!=0)
sb.append(", return detected");
else
sb.append(", return not detected");
}
if ((val & 0x10)!=0)
sb.append(", auto");
if ((val & 0x40)!=0)
sb.append(", red-eye reduction");
return sb.toString();
}
public String getWhiteBalanceDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_WHITE_BALANCE)) return null;
// '0' means unknown, '1' daylight, '2' fluorescent, '3' tungsten, '10' flash,
// '17' standard light A, '18' standard light B, '19' standard light C, '20' D55,
// '21' D65, '22' D75, '255' other.
switch (_directory.getInt(ExifDirectory.TAG_WHITE_BALANCE)) {
case 0:
return "Unknown";
case 1:
return "Daylight";
case 2:
return "Flourescent";
case 3:
return "Tungsten";
case 10:
return "Flash";
case 17:
return "Standard light";
case 18:
return "Standard light (B)";
case 19:
return "Standard light (C)";
case 20:
return "D55";
case 21:
return "D65";
case 22:
return "D75";
case 255:
return "(Other)";
default:
return "Unknown (" + _directory.getInt(ExifDirectory.TAG_WHITE_BALANCE) + ")";
}
}
public String getMeteringModeDescription() throws MetadataException
{
if (!_directory.containsTag(ExifDirectory.TAG_METERING_MODE)) return null;
// '0' means unknown, '1' average, '2' center weighted average, '3' spot
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -