Ejemplo n.º 1
0
 public FileMetadata(BitmapMetadata bitmapMetadata)
 {
     this.exifProvider         = new ExifProvider(bitmapMetadata);
     this.gpsProvider          = new GpsProvider(bitmapMetadata);
     this.iptcProvider         = new IptcProvider(bitmapMetadata);
     this.xmpCoreProvider      = new XmpCoreProvider(bitmapMetadata);
     this.xmpExifProvider      = new XmpExifProvider(bitmapMetadata);
     this.xmpFotoflyProvider   = new XmpFotoflyProvider(bitmapMetadata);
     this.xmpMicrosoftProvider = new XmpMicrosoftProvider(bitmapMetadata);
     this.xmpRightsProvider    = new XmpRightsProvider(bitmapMetadata);
     this.xmpIptcProvider      = new XmpIptcProvider(bitmapMetadata);
     this.xmpTiffProvider      = new XmpTiffProvider(bitmapMetadata);
     this.xmpXapProvider       = new XmpXapProvider(bitmapMetadata);
     this.xmpPhotoshopProvider = new XmpPhotoshopProvider(bitmapMetadata);
     this.bitmapMetadata       = bitmapMetadata;
 }
Ejemplo n.º 2
0
        public void ReadXmpExifMetadata()
        {
            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.SchemaXmpExif))
            {
                XmpExifProvider xmpExifProvider = new XmpExifProvider(wpfFileManager.BitmapMetadata);

                Assert.AreEqual <string>(xmpExifProvider.FocalLength, "6200/1000");
                Assert.AreEqual <Aperture>(xmpExifProvider.MaxApertureValue, new Aperture(95, 32));
                Assert.AreEqual <Aperture>(xmpExifProvider.Aperture, new Aperture(80, 10));
                Assert.AreEqual <string>(xmpExifProvider.ExifVersion, "0220");
                Assert.AreEqual <MetadataEnums.MeteringModes>(xmpExifProvider.MeteringMode, MetadataEnums.MeteringModes.Pattern);
                Assert.AreEqual <IsoSpeed>(xmpExifProvider.IsoSpeed, new IsoSpeed(80));
                Assert.AreEqual <string>(xmpExifProvider.WhiteBalance, "0");
                Assert.AreEqual <double?>(xmpExifProvider.DigitalZoomRatio, 0.0);
                Assert.AreEqual <ExposureBias>(xmpExifProvider.ExposureBias, new ExposureBias("0/3"));
            }
        }
Ejemplo n.º 3
0
        public void ReadXmpGpsMetadata()
        {
            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.GeotaggedXmp1))
            {
                // Expected 51° 55.6784 N 4° 26.6922 E
                XmpExifProvider xmpExifProvider = new XmpExifProvider(wpfFileManager.BitmapMetadata);

                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLatitude, new GpsCoordinate(GpsCoordinate.LatitudeRef.North, 51, 55.6784), "Latitude");
                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLongitude, new GpsCoordinate(GpsCoordinate.LongitudeRef.East, 4, 26.6922), "Longitude");
                Assert.AreEqual <double>(xmpExifProvider.GpsAltitude, Double.NaN, "Altitude");
                Assert.AreEqual <string>(xmpExifProvider.GpsVersionID, "2.2.0.0", "Gps VersionID");
                Assert.AreEqual <string>(xmpExifProvider.GpsDateTimeStamp.ToString("u", DateTimeFormatInfo.InvariantInfo), "2010-02-01 22:02:34Z", "Satalite Time");
            }

            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.GeotaggedXmp2))
            {
                // Expected 51° 55.7057 N 4° 26.9547 E
                XmpExifProvider xmpExifProvider = new XmpExifProvider(wpfFileManager.BitmapMetadata);

                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLatitude, new GpsCoordinate(GpsCoordinate.LatitudeRef.North, 51, 55.7057));
                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLongitude, new GpsCoordinate(GpsCoordinate.LongitudeRef.East, 4, 26.9547));
                Assert.AreEqual <string>(xmpExifProvider.GpsDateTimeStamp.ToString("u"), "2010-02-01 22:25:12Z");
            }

            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.GeotaggedXmp3))
            {
                // Expected 51° 55.6767 N 4° 27.2393 E
                XmpExifProvider xmpExifProvider = new XmpExifProvider(wpfFileManager.BitmapMetadata);

                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLatitude, new GpsCoordinate(GpsCoordinate.LatitudeRef.North, 51, 55.6767));
                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLongitude, new GpsCoordinate(GpsCoordinate.LongitudeRef.East, 4, 27.2393));
                Assert.AreEqual <string>(xmpExifProvider.GpsDateTimeStamp.ToString("u"), "2010-02-01 23:35:07Z");
            }

            using (WpfFileManager wpfFileManager = new WpfFileManager(this.samplePhotosFolder + TestPhotos.GeotaggedXmp4))
            {
                // Expected: GPSAltitude 2/1 GPSLatitude 51,55.4804N GPSLongitude 4,27,9E
                XmpExifProvider xmpExifProvider = new XmpExifProvider(wpfFileManager.BitmapMetadata);

                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLatitude, new GpsCoordinate(GpsCoordinate.LatitudeRef.North, 51, 55.4804));
                Assert.AreEqual <GpsCoordinate>(xmpExifProvider.GpsLongitude, new GpsCoordinate(GpsCoordinate.LongitudeRef.East, 4, 27, 9));
                Assert.AreEqual <string>(xmpExifProvider.GpsDateTimeStamp.ToString("u"), "2010-02-01 23:00:52Z");
            }
        }