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

The following examples show how to use com.drew.lang.Rational#getNumerator() . 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 getBrightnessValueDescription()
{
    Rational value = _directory.getRational(TAG_BRIGHTNESS_VALUE);
    if (value == null)
        return null;
    if (value.getNumerator() == 0xFFFFFFFFL)
        return "Unknown";
    DecimalFormat formatter = new DecimalFormat("0.0##");
    return formatter.format(value.doubleValue());
}
 
Example 2
Source File: ExifDescriptorBase.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getSubjectDistanceDescription()
{
    Rational value = _directory.getRational(TAG_SUBJECT_DISTANCE);
    if (value == null)
        return null;
    if (value.getNumerator() == 0xFFFFFFFFL)
        return "Infinity";
    if (value.getNumerator() == 0)
        return "Unknown";
    DecimalFormat formatter = new DecimalFormat("0.0##");
    return formatter.format(value.doubleValue()) + " metres";
}
 
Example 3
Source File: ExifDescriptorBase.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getDigitalZoomRatioDescription()
{
    Rational value = _directory.getRational(TAG_DIGITAL_ZOOM_RATIO);
    return value == null
        ? null
        : value.getNumerator() == 0
            ? "Digital zoom not used"
            : new DecimalFormat("0.#").format(value.doubleValue());
}
 
Example 4
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 5
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 6
Source File: OlympusFocusInfoMakernoteDescriptor.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getFocusDistanceDescription()
{
    Rational value = _directory.getRational(TagFocusDistance);
    if (value == null)
        return "inf";
    if (value.getNumerator() == 0xFFFFFFFFL || value.getNumerator() == 0x00000000L)
        return "inf";

    return value.getNumerator() / 1000.0 + " m";
}