Java Code Examples for com.drew.lang.Rational#toSimpleString()

The following examples show how to use com.drew.lang.Rational#toSimpleString() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ExifDescriptorBase.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getCompressedAverageBitsPerPixelDescription()
{
    Rational value = _directory.getRational(TAG_COMPRESSED_AVERAGE_BITS_PER_PIXEL);
    if (value == null)
        return null;
    String ratio = value.toSimpleString(_allowDecimalRepresentationOfRationals);
    return value.isInteger() && value.intValue() == 1
        ? ratio + " bit/pixel"
        : ratio + " bits/pixel";
}
 
Example 2
Source File: ExifDescriptorBase.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getExposureBiasDescription()
{
    Rational value = _directory.getRational(TAG_EXPOSURE_BIAS);
    if (value == null)
        return null;
    return value.toSimpleString(true) + " EV";
}
 
Example 3
Source File: NikonType1MakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getDigitalZoomDescription()
{
    Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
    return value == null
        ? null
        : value.getNumerator() == 0
            ? "No digital zoom"
            : value.toSimpleString(true) + "x digital zoom";
}
 
Example 4
Source File: NikonType1MakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getFocusDescription()
{
    Rational value = _directory.getRational(TAG_FOCUS);
    return value == null
        ? null
        : value.getNumerator() == 1 && value.getDenominator() == 0
            ? "Infinite"
            : value.toSimpleString(true);
}
 
Example 5
Source File: NikonType2MakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getDigitalZoomDescription()
{
    Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
    if (value==null)
        return null;
    return value.intValue() == 1
            ? "No digital zoom"
            : value.toSimpleString(true) + "x digital zoom";
}
 
Example 6
Source File: OlympusMakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getDigitalZoomDescription()
{
    Rational value = _directory.getRational(TAG_DIGITAL_ZOOM);
    if (value == null)
        return null;
    return value.toSimpleString(false);
}
 
Example 7
Source File: TagDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
protected String getSimpleRational(final int tagType)
{
    Rational value = _directory.getRational(tagType);
    if (value == null)
        return null;
    return value.toSimpleString(true);
}
 
Example 8
Source File: TagDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
protected String getRationalOrDoubleString(int tagType)
{
    Rational rational = _directory.getRational(tagType);
    if (rational != null)
        return rational.toSimpleString(true);

    Double d = _directory.getDoubleObject(tagType);
    if (d != null) {
        DecimalFormat format = new DecimalFormat("0.###");
        return format.format(d);
    }

    return null;
}
 
Example 9
Source File: FujifilmMakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 4 votes vote down vote up
@Nullable
public String getFlashExposureValueDescription()
{
    Rational value = _directory.getRational(TAG_FLASH_EV);
    return value == null ? null : value.toSimpleString(false) + " EV (Apex)";
}