com.drew.metadata.exif.makernotes.NikonType2MakernoteDirectory Java Examples

The following examples show how to use com.drew.metadata.exif.makernotes.NikonType2MakernoteDirectory. 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: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
@Test
public void testNikonMakernote_MatchesKnownValues() throws Exception
{
    assertEquals("48 50 48 48", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_FIRMWARE_VERSION));
    assertEquals("0 320", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_ISO_1));
    assertEquals("0 320", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_ISO_REQUESTED));
    assertEquals("FLASH       ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_WHITE_BALANCE));
    assertEquals("AUTO  ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_SHARPENING));
    assertEquals("AF-C  ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_AF_TYPE));
    assertEquals("NORMAL      ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_FLASH_SYNC_MODE));
    assertEquals("0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_WHITE_BALANCE_FINE));
    assertEquals("914", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_PREVIEW_IFD));
    assertEquals("AUTO    ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_TONE_COMPENSATION));
    assertEquals("6", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_LENS_TYPE));
    assertEquals("240/10 850/10 35/10 45/10", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_LENS));
    assertEquals("0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_FLASH_USED));
    assertEquals("1", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_SHOOTING_MODE));
    assertEquals("0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_UNKNOWN_20));
    assertEquals("MODE1   ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_COLOR_MODE));
    assertEquals("NATURAL    ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_LIGHT_SOURCE));
    assertEquals("0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_HUE_ADJUSTMENT));
    assertEquals("OFF ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_NOISE_REDUCTION));
    assertEquals("78/10 78/10", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_SENSOR_PIXEL_SIZE));
}
 
Example #2
Source File: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 6 votes vote down vote up
@Test
public void testGetAutoFlashCompensationDescription() throws Exception
{
    NikonType2MakernoteDirectory directory = new NikonType2MakernoteDirectory();
    NikonType2MakernoteDescriptor descriptor = new NikonType2MakernoteDescriptor(directory);

    // no entry exists
    assertNull(descriptor.getAutoFlashCompensationDescription());

    directory.setByteArray(NikonType2MakernoteDirectory.TAG_AUTO_FLASH_COMPENSATION, new byte[] { 0x06, 0x01, 0x06 });
    assertEquals("1 EV", descriptor.getAutoFlashCompensationDescription());

    directory.setByteArray(NikonType2MakernoteDirectory.TAG_AUTO_FLASH_COMPENSATION, new byte[] { 0x04, 0x01, 0x06 });
    assertEquals("0.67 EV", descriptor.getAutoFlashCompensationDescription());

    directory.setByteArray(NikonType2MakernoteDirectory.TAG_AUTO_FLASH_COMPENSATION, new byte[] { 0x02, 0x01, 0x06 });
    assertEquals("0.33 EV", descriptor.getAutoFlashCompensationDescription());

    directory.setByteArray(NikonType2MakernoteDirectory.TAG_AUTO_FLASH_COMPENSATION, new byte[] { (byte)0xFE, 0x01, 0x06 });
    assertEquals("-0.33 EV", descriptor.getAutoFlashCompensationDescription());
}
 
Example #3
Source File: ImageRecordReader.java    From Bats with Apache License 2.0 5 votes vote down vote up
private boolean isVersionTag(final Directory directory, final int tagType) {
  return directory instanceof ExifSubIFDDirectory &&
      (tagType == ExifSubIFDDirectory.TAG_EXIF_VERSION || tagType == ExifSubIFDDirectory.TAG_FLASHPIX_VERSION) ||
      directory instanceof ExifInteropDirectory &&
      tagType == ExifInteropDirectory.TAG_INTEROP_VERSION ||
      directory instanceof FujifilmMakernoteDirectory &&
      tagType == FujifilmMakernoteDirectory.TAG_MAKERNOTE_VERSION ||
      directory instanceof NikonType2MakernoteDirectory &&
      tagType == NikonType2MakernoteDirectory.TAG_FIRMWARE_VERSION ||
      directory instanceof OlympusCameraSettingsMakernoteDirectory &&
      tagType == OlympusCameraSettingsMakernoteDirectory.TagCameraSettingsVersion ||
      directory instanceof OlympusEquipmentMakernoteDirectory &&
      tagType == OlympusEquipmentMakernoteDirectory.TAG_EQUIPMENT_VERSION ||
      directory instanceof OlympusFocusInfoMakernoteDirectory &&
      tagType == OlympusFocusInfoMakernoteDirectory.TagFocusInfoVersion ||
      directory instanceof OlympusImageProcessingMakernoteDirectory &&
      tagType == OlympusImageProcessingMakernoteDirectory.TagImageProcessingVersion ||
      directory instanceof OlympusMakernoteDirectory &&
      tagType == OlympusMakernoteDirectory.TAG_MAKERNOTE_VERSION ||
      directory instanceof OlympusRawDevelopment2MakernoteDirectory &&
      tagType == OlympusRawDevelopment2MakernoteDirectory.TagRawDevVersion ||
      directory instanceof OlympusRawDevelopmentMakernoteDirectory &&
      tagType == OlympusRawDevelopmentMakernoteDirectory.TagRawDevVersion ||
      directory instanceof OlympusRawInfoMakernoteDirectory &&
      tagType == OlympusRawInfoMakernoteDirectory.TagRawInfoVersion ||
      directory instanceof PanasonicMakernoteDirectory &&
      (tagType == PanasonicMakernoteDirectory.TAG_FIRMWARE_VERSION || tagType == PanasonicMakernoteDirectory.TAG_MAKERNOTE_VERSION || tagType == PanasonicMakernoteDirectory.TAG_EXIF_VERSION) ||
      directory instanceof SamsungType2MakernoteDirectory &&
      tagType == SamsungType2MakernoteDirectory.TagMakerNoteVersion ||
      directory instanceof SonyType6MakernoteDirectory &&
      tagType == SonyType6MakernoteDirectory.TAG_MAKERNOTE_THUMB_VERSION ||
      directory instanceof PanasonicRawIFD0Directory &&
      tagType == PanasonicRawIFD0Directory.TagPanasonicRawVersion;
}
 
Example #4
Source File: NikonType2MakernoteTest2.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{
    _metadata = ExifReaderTest.processBytes("Tests/Data/nikonMakernoteType2b.jpg.app1");

    _nikonDirectory = _metadata.getFirstDirectoryOfType(NikonType2MakernoteDirectory.class);
    _exifIFD0Directory = _metadata.getFirstDirectoryOfType(ExifIFD0Directory.class);
    _exifSubIFDDirectory = _metadata.getFirstDirectoryOfType(ExifSubIFDDirectory.class);
    _thumbDirectory = _metadata.getFirstDirectoryOfType(ExifThumbnailDirectory.class);

    assertNotNull(_nikonDirectory);
    assertNotNull(_exifSubIFDDirectory);
}
 
Example #5
Source File: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 5 votes vote down vote up
@Before
public void setUp() throws Exception
{
    Locale.setDefault(new Locale("en", "GB"));

    _nikonDirectory = ExifReaderTest.processBytes("Tests/Data/nikonMakernoteType2a.jpg.app1", NikonType2MakernoteDirectory.class);

    assertNotNull(_nikonDirectory);

    _descriptor = new NikonType2MakernoteDescriptor(_nikonDirectory);
}
 
Example #6
Source File: NikonType2MakernoteTest2.java    From metadata-extractor with Apache License 2.0 4 votes vote down vote up
@Test
    public void testNikonMakernote_MatchesKnownValues() throws Exception
    {
        assertEquals("0 1 0 0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_FIRMWARE_VERSION));
        assertEquals("0 0", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_ISO_1));
        assertEquals("COLOR", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_COLOR_MODE));
        assertEquals("NORMAL ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_QUALITY_AND_FILE_FORMAT));
        assertEquals("AUTO        ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_WHITE_BALANCE));
        assertEquals("AUTO  ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_CAMERA_SHARPENING));
        assertEquals("AF-C  ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_AF_TYPE));
        assertEquals("NORMAL      ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_FLASH_SYNC_MODE));
//        assertEquals(new Rational(4416,500), _nikonDirectory.getRational(NikonType3MakernoteDirectory.TAG_UNKNOWN_2));
        assertEquals("AUTO  ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_ISO_MODE));
        assertEquals(1300, _nikonDirectory.getInt(0x0011));
        assertEquals("AUTO         ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_IMAGE_ADJUSTMENT));
        assertEquals("OFF         ", _nikonDirectory.getString(NikonType2MakernoteDirectory.TAG_ADAPTER));
        assertEquals(0, _nikonDirectory.getInt(NikonType2MakernoteDirectory.TAG_MANUAL_FOCUS_DISTANCE));
        assertEquals(1, _nikonDirectory.getInt(NikonType2MakernoteDirectory.TAG_DIGITAL_ZOOM));
        assertEquals("                ", _nikonDirectory.getString(0x008f));
        assertEquals(0, _nikonDirectory.getInt(0x0094));
        assertEquals("FPNR", _nikonDirectory.getString(0x0095));

        // PrintIM
        HashMap<Integer, String> _expectedData = new HashMap<Integer, String>();
        _expectedData.put(0x0000, "0100");
        _expectedData.put(0x0001, "0x00160016");
        _expectedData.put(0x0002, "0x00000001");
        _expectedData.put(0x0003, "0x0000005e");
        _expectedData.put(0x0007, "0x00000000");
        _expectedData.put(0x0008, "0x00000000");
        _expectedData.put(0x0009, "0x00000000");
        _expectedData.put(0x000A, "0x00000000");
        _expectedData.put(0x000B, "0x000000a6");
        _expectedData.put(0x000C, "0x00000000");
        _expectedData.put(0x000D, "0x00000000");
        _expectedData.put(0x000E, "0x000000be");
        _expectedData.put(0x0100, "0x00000005");
        _expectedData.put(0x0101, "0x00000001");

        PrintIMDirectory nikonPrintImDirectory = _metadata.getFirstDirectoryOfType(PrintIMDirectory.class);

        assertNotNull(nikonPrintImDirectory);

        assertEquals(_expectedData.size(), nikonPrintImDirectory.getTagCount());
        for (Map.Entry<Integer, String> _expected : _expectedData.entrySet())
        {
            assertEquals(_expected.getValue(), nikonPrintImDirectory.getDescription(_expected.getKey()));
        }

//        assertEquals("80 114 105 110 116 73 77 0 48 49 48 48 0 0 13 0 1 0 22 0 22 0 2 0 1 0 0 0 3 0 94 0 0 0 7 0 0 0 0 0 8 0 0 0 0 0 9 0 0 0 0 0 10 0 0 0 0 0 11 0 166 0 0 0 12 0 0 0 0 0 13 0 0 0 0 0 14 0 190 0 0 0 0 1 5 0 0 0 1 1 1 0 0 0 9 17 0 0 16 39 0 0 11 15 0 0 16 39 0 0 151 5 0 0 16 39 0 0 176 8 0 0 16 39 0 0 1 28 0 0 16 39 0 0 94 2 0 0 16 39 0 0 139 0 0 0 16 39 0 0 203 3 0 0 16 39 0 0 229 27 0 0 16 39 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0", _nikonDirectory.getString(0x0e00));
//        assertEquals("PrintIM", _nikonDirectory.getString(0x0e00));
        assertEquals(1394, _nikonDirectory.getInt(0x0e10));
    }
 
Example #7
Source File: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetLensDescription() throws MetadataException
{
    assertEquals("24-85mm f/3.5-4.5", _descriptor.getDescription(NikonType2MakernoteDirectory.TAG_LENS));
    assertEquals("24-85mm f/3.5-4.5", _descriptor.getLensDescription());
}
 
Example #8
Source File: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetHueAdjustmentDescription() throws MetadataException
{
    assertEquals("0 degrees", _descriptor.getDescription(NikonType2MakernoteDirectory.TAG_CAMERA_HUE_ADJUSTMENT));
    assertEquals("0 degrees", _descriptor.getHueAdjustmentDescription());
}
 
Example #9
Source File: NikonType2MakernoteTest1.java    From metadata-extractor with Apache License 2.0 4 votes vote down vote up
@Test
public void testGetColorModeDescription() throws Exception
{
    assertEquals("Mode I (sRGB)", _descriptor.getDescription(NikonType2MakernoteDirectory.TAG_CAMERA_COLOR_MODE));
    assertEquals("Mode I (sRGB)", _descriptor.getColorModeDescription());
}